rpudlGetLayerWeights {rpud} | R Documentation |
Retrieve weights of a layer element in an rpudl
object
rpudlGetLayerWeights(model, layer.name)
model |
a |
layer.name |
name of a layer element in the model |
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.
Chi Yau
chi.yau@r-tutor.com
rpudl,
rpudlTrain,
rpudlPlotLayerWeights
## 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)