Skip to content

Instantly share code, notes, and snippets.

@pratikac
Created May 27, 2015 12:05
Show Gist options
  • Save pratikac/810f5487d03c2e13272c to your computer and use it in GitHub Desktop.
Save pratikac/810f5487d03c2e13272c to your computer and use it in GitHub Desktop.
function get_model()
local m = nn:Sequential()
m:add(cudnn.SpatialConvolution(1, 32, 5, 5))
m:add(cudnn.ReLU(true))
m:add(cudnn.SpatialMaxPooling(3,3,3,3))
m:add(cudnn.SpatialConvolution(32, 64, 5, 5))
m:add(cudnn.ReLU(true))
m:add(cudnn.SpatialMaxPooling(2,2,2,2))
m:add(nn.View(64*2*2))
m:add(nn.Dropout(opt.dropout))
m:add(nn.Linear(64*2*2, 256))
m:add(cudnn.ReLU(true))
m:add(nn.Dropout(opt.dropout))
m:add(nn.Linear(256, 256))
m:add(nn.ReLU(true))
m:add(nn.Linear(256, #classes))
m:add(nn.LogSoftMax())
local cost_function = nn.ClassNLLCriterion()
return m, cost_function
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment