rpudlGetLayerWeights {rpud}R Documentation

Weights of a Layer Element in an RPUDL model

Description

Retrieve weights of a layer element in an rpudl object

Usage

rpudlGetLayerWeights(model, layer.name)

Arguments

model

a rpudl model object

layer.name

name of a layer element in the model

Value

A 4 dimensional array that inherits the class rpudlGetLayerWeights and contains the weight parameters of a layer element. The first and second dimensions are the number of rows and columns of the weight parameters. The third dimension is the number of input channels, and the fourth dimension is the number of output channels.

Author(s)

Chi Yau
chi.yau@r-tutor.com

See Also

rpudl,
rpudlTrain,
rpudlPlotLayerWeights

Examples

## Not run: 
# create data source
ds <- rpudlCreateDataSource(
        data.format="lmdb",
        data.dir="data/mnist",
        train.data="mnist-official-data_train_lmdb",
        test.data="mnist-official-data_test_lmdb",
        data.shape=c(28, 28)
)

# create model
model <- rpudl(
        "mnist_mpl_lenet.prototxt",
        data.source=ds
)   

# train model
model <- rpudlTrain(model, batch=100, iter=1000)

# extract weights
weights <- rpudlGetLayerWeights(model, "conv1"); str(weights)

# plot weights
library(gg2plot)
rpudlPlotLayerWeights(weights)

## End(Not run)

[Package rpud version 0.7.1 Index]