Arquivos
Brian Broll 09b6ca0ad0 Added basic torch import functionality. Fixes #3
WIP #3. Added import tests

WIP #3 Added more test-cases

WIP #3 Added more tests

WIP #3. Fixed concat.lua test

WIP #3 minor changes

WIP #3 Fixed concat-parallel.lua

WIP #3 Added check-model helper

WIP #3 Added more tests for model checker

WIP #3 Added extra tests

WIP #3 Changed check-model to GraphChecker

WIP #3. multiple cases fail for ImportTorch...

WIP #3 Fixed ImportTorch batch test case running

WIP #3 Changed graph checker to use gme path for id

WIP #3 Updated tests

WIP #3. Tweaked to get all examples working locally w/ 'th'

WIP #3 Fixed tests
2016-04-09 09:35:41 -05:00

31 linhas
1.3 KiB
Lua

require 'nn'
-- a typical convolutional network, with locally-normalized hidden
-- units, and L2-pooling
-- Note: the architecture of this convnet is loosely based on Pierre Sermanet's
-- work on this dataset (http://arxiv.org/abs/1204.3968). In particular
-- the use of LP-pooling (with P=2) has a very positive impact on
-- generalization. Normalization is not done exactly as proposed in
-- the paper, and low-level (first layer) features are not fed to
-- the classifier.
model = nn.Sequential()
-- stage 1 : filter bank -> squashing -> L2 pooling -> normalization
model:add(nn.SpatialConvolutionMM(nfeats, nstates[1], filtsize, filtsize))
model:add(nn.Tanh())
model:add(nn.SpatialLPPooling(nstates[1],2,poolsize,poolsize,poolsize,poolsize))
model:add(nn.SpatialSubtractiveNormalization(nstates[1], normkernel))
-- stage 2 : filter bank -> squashing -> L2 pooling -> normalization
model:add(nn.SpatialConvolutionMM(nstates[1], nstates[2], filtsize, filtsize))
model:add(nn.Tanh())
model:add(nn.SpatialLPPooling(nstates[2],2,poolsize,poolsize,poolsize,poolsize))
model:add(nn.SpatialSubtractiveNormalization(nstates[2], normkernel))
-- stage 3 : standard 2-layer neural network
model:add(nn.Reshape(nstates[2]*filtsize*filtsize))
model:add(nn.Linear(nstates[2]*filtsize*filtsize, nstates[3]))
model:add(nn.Tanh())
model:add(nn.Linear(nstates[3], noutputs))