I built an nn model using itorch notebook.
model = nn.Sequential() model:add(nn.Reshape(ninputs)) model:add(nn.Linear(ninputs,noutputs))
Model Input
output = model:forward(input)
Then I print the model and get it.
print(model) nn.Sequential { [input -> (1) -> (2) -> output] (1): nn.Reshape(3072) (2): nn.Linear(3072 -> 10) } { gradInput : DoubleTensor - empty modules : { 1 : nn.Reshape(3072) { _input : DoubleTensor - empty nelement : 3072 train : true output : DoubleTensor - size: 3072 gradInput : DoubleTensor - empty size : LongStorage - size: 1 _gradOutput : DoubleTensor - empty batchsize : LongStorage - size: 2 } 2 : nn.Linear(3072 -> 10) { gradBias : DoubleTensor - size: 10 weight : DoubleTensor - size: 10x3072 train : true bias : DoubleTensor - size: 10 gradInput : DoubleTensor - empty gradWeight : DoubleTensor - size: 10x3072 output : DoubleTensor - size: 10 } } train : true output : DoubleTensor - size: 10 }
how to read weight in nn.linear?
Thanks in advance.
source share