Skip to content

Instantly share code, notes, and snippets.

@soumith
Created May 14, 2014 18:05
Show Gist options
  • Save soumith/ff18530894829d1443a2 to your computer and use it in GitHub Desktop.
Save soumith/ff18530894829d1443a2 to your computer and use it in GitHub Desktop.
require 'torch'
require 'nn'
torch.setdefaulttensortype('torch.FloatTensor')
frameSize = 4 -- each input frame has 4 numbers
hiddenSize = 5 -- each hidden layer has 5 units
outputSize = 1 -- each output layer has 1 output
-------------- Model -------------------------
mlp = nn.Sequential()
mlp:add(nn.TemporalConvolution(frameSize,hiddenSize,1,1))
mlp:add(nn.TemporalConvolution(hiddenSize,outputSize,1,1))
mlp:add(nn.Sum(1)) -- sum up all the outputs
-------------- End of Model -------------------------
input = torch.rand(8,frameSize) -- 8 frames of 4 numbers each = 32 numbers in total
print(mlp:forward(input))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment