822a4080e5
WIP #40 Updated overfeat devTest Fixed setting values to null. WIP #40 WIP #40 Fixed attr name typos WIP #40 Updated tests
16 linhas
978 B
Lua
16 linhas
978 B
Lua
require 'nn'
|
|
net = nn.Sequential()
|
|
net:add(nn.SpatialConvolution(3, 6, 5, 5)) -- 1 input image channel, 6 output channels, 5x5 convolution kernel
|
|
net:add(nn.ReLU()) -- non-linearity
|
|
net:add(nn.SpatialMaxPooling(2,2,2,2)) -- A max-pooling operation that looks at 2x2 windows and finds the max.
|
|
net:add(nn.SpatialConvolution(6, 16, 5, 5))
|
|
net:add(nn.ReLU()) -- non-linearity
|
|
net:add(nn.SpatialMaxPooling(2,2,2,2))
|
|
net:add(nn.View(16*5*5)) -- reshapes from a 3D tensor of 16x5x5 into 1D tensor of 16*5*5
|
|
net:add(nn.Linear(16*5*5, 120)) -- fully connected layer (matrix multiplication between input and weights)
|
|
net:add(nn.ReLU()) -- non-linearity
|
|
net:add(nn.Linear(120, 84))
|
|
net:add(nn.ReLU()) -- non-linearity
|
|
net:add(nn.Linear(84, 10)) -- 10 is the number of outputs of the network (in this case, 10 digits)
|
|
net:add(nn.LogSoftMax())
|