require 'cudnn'
local model = {}
table.insert(model, {'conv1_1', cudnn.SpatialConvolution(3, 64, 3, 3, 1, 1, 1, 1, 1)})
table.insert(model, {'relu1_1', cudnn.ReLU(true)})
table.insert(model, {'conv1_2', cudnn.SpatialConvolution(64, 64, 3, 3, 1, 1, 1, 1, 1)})
table.insert(model, {'relu1_2', cudnn.ReLU(true)})
table.insert(model, {'pool1', cudnn.SpatialMaxPooling(2, 2, 2, 2, 0, 0):ceil()})
table.insert(model, {'conv2_1', cudnn.SpatialConvolution(64, 128, 3, 3, 1, 1, 1, 1, 1)})
table.insert(model, {'relu2_1', cudnn.ReLU(true)})
table.insert(model, {'conv2_2', cudnn.SpatialConvolution(128, 128, 3, 3, 1, 1, 1, 1, 1)})
table.insert(model, {'relu2_2', cudnn.ReLU(true)})
table.insert(model, {'pool2', cudnn.SpatialMaxPooling(2, 2, 2, 2, 0, 0):ceil()})
table.insert(model, {'conv3_1', cudnn.SpatialConvolution(128, 256, 3, 3, 1, 1, 1, 1, 1)})
table.insert(model, {'relu3_1', cudnn.ReLU(true)})
table.insert(model, {'conv3_2', cudnn.SpatialConvolution(256, 256, 3, 3, 1, 1, 1, 1, 1)})
table.insert(model, {'relu3_2', cudnn.ReLU(true)})
table.insert(model, {'conv3_3', cudnn.SpatialConvolution(256, 256, 3, 3, 1, 1, 1, 1, 1)})
table.insert(model, {'relu3_3', cudnn.ReLU(true)})
table.insert(model, {'pool3', cudnn.SpatialMaxPooling(2, 2, 2, 2, 0, 0):ceil()})
table.insert(model, {'conv4_1', cudnn.SpatialConvolution(256, 512, 3, 3, 1, 1, 1, 1, 1)})
table.insert(model, {'relu4_1', cudnn.ReLU(true)})
table.insert(model, {'conv4_2', cudnn.SpatialConvolution(512, 512, 3, 3, 1, 1, 1, 1, 1)})
table.insert(model, {'relu4_2', cudnn.ReLU(true)})
table.insert(model, {'conv4_3', cudnn.SpatialConvolution(512, 512, 3, 3, 1, 1, 1, 1, 1)})
table.insert(model, {'relu4_3', cudnn.ReLU(true)})
table.insert(model, {'pool4', cudnn.SpatialMaxPooling(2, 2, 2, 2, 0, 0):ceil()})
table.insert(model, {'conv5_1', cudnn.SpatialConvolution(512, 512, 3, 3, 1, 1, 1, 1, 1)})
table.insert(model, {'relu5_1', cudnn.ReLU(true)})
table.insert(model, {'conv5_2', cudnn.SpatialConvolution(512, 512, 3, 3, 1, 1, 1, 1, 1)})
table.insert(model, {'relu5_2', cudnn.ReLU(true)})
table.insert(model, {'conv5_3', cudnn.SpatialConvolution(512, 512, 3, 3, 1, 1, 1, 1, 1)})
table.insert(model, {'relu5_3', cudnn.ReLU(true)})
table.insert(model, {'pool5', cudnn.SpatialMaxPooling(2, 2, 2, 2, 0, 0):ceil()})
table.insert(model, {'torch_view', nn.View(-1):setNumInputDims(3)})
table.insert(model, {'fc6', nn.Linear(25088, 4096)})
table.insert(model, {'relu6', cudnn.ReLU(true)})
table.insert(model, {'drop6', nn.Dropout(0.500000)})
table.insert(model, {'fc7', nn.Linear(4096, 4096)})
table.insert(model, {'relu7', cudnn.ReLU(true)})
table.insert(model, {'drop7', nn.Dropout(0.500000)})
table.insert(model, {'fc8', nn.Linear(4096, 1000)})
table.insert(model, {'prob', cudnn.SoftMax()})
return model