import numpy as np
from latte import *



data = MemoryDataLayer(net, (3, 224, 224))
conv1 = ConvLayer(net, data, num_filters=64, kernel=7, stride=2, pad=3)
conv1_relu = ReLULayer(net, conv1)
pool1 = MaxPoolingLayer(net, conv1, kernel=3, stride=2, pad=0)
res2a_branch1 = FullyConnectedLayer(net, pool1, 256)
res2a_branch2a = FullyConnectedLayer(net, pool1, 64)
res2a_branch2a_relu = ReLULayer(net, res2a_branch2a)
res2a_branch2b = ConvLayer(net, res2a_branch2a, num_filters=64, kernel=3, stride=1, pad=1)
res2a_branch2b_relu = ReLULayer(net, res2a_branch2b)
res2a_branch2c = FullyConnectedLayer(net, res2a_branch2b, 256)
res2a_relu = ReLULayer(net, res2a)
res2b_branch2a = FullyConnectedLayer(net, res2a, 64)
res2b_branch2a_relu = ReLULayer(net, res2b_branch2a)
res2b_branch2b = ConvLayer(net, res2b_branch2a, num_filters=64, kernel=3, stride=1, pad=1)
res2b_branch2b_relu = ReLULayer(net, res2b_branch2b)
res2b_branch2c = FullyConnectedLayer(net, res2b_branch2b, 256)
res2b_relu = ReLULayer(net, res2b)
res2c_branch2a = FullyConnectedLayer(net, res2b, 64)
res2c_branch2a_relu = ReLULayer(net, res2c_branch2a)
res2c_branch2b = ConvLayer(net, res2c_branch2a, num_filters=64, kernel=3, stride=1, pad=1)
res2c_branch2b_relu = ReLULayer(net, res2c_branch2b)
res2c_branch2c = FullyConnectedLayer(net, res2c_branch2b, 256)
res2c_relu = ReLULayer(net, res2c)
res3a_branch1 = FullyConnectedLayer(net, res2c, 512)
res3a_branch2a = FullyConnectedLayer(net, res2c, 128)
res3a_branch2a_relu = ReLULayer(net, res3a_branch2a)
res3a_branch2b = ConvLayer(net, res3a_branch2a, num_filters=128, kernel=3, stride=1, pad=1)
res3a_branch2b_relu = ReLULayer(net, res3a_branch2b)
res3a_branch2c = FullyConnectedLayer(net, res3a_branch2b, 512)
res3a_relu = ReLULayer(net, res3a)
res3b_branch2a = FullyConnectedLayer(net, res3a, 128)
res3b_branch2a_relu = ReLULayer(net, res3b_branch2a)
res3b_branch2b = ConvLayer(net, res3b_branch2a, num_filters=128, kernel=3, stride=1, pad=1)
res3b_branch2b_relu = ReLULayer(net, res3b_branch2b)
res3b_branch2c = FullyConnectedLayer(net, res3b_branch2b, 512)
res3b_relu = ReLULayer(net, res3b)
res3c_branch2a = FullyConnectedLayer(net, res3b, 128)
res3c_branch2a_relu = ReLULayer(net, res3c_branch2a)
res3c_branch2b = ConvLayer(net, res3c_branch2a, num_filters=128, kernel=3, stride=1, pad=1)
res3c_branch2b_relu = ReLULayer(net, res3c_branch2b)
res3c_branch2c = FullyConnectedLayer(net, res3c_branch2b, 512)
res3c_relu = ReLULayer(net, res3c)
res3d_branch2a = FullyConnectedLayer(net, res3c, 128)
res3d_branch2a_relu = ReLULayer(net, res3d_branch2a)
res3d_branch2b = ConvLayer(net, res3d_branch2a, num_filters=128, kernel=3, stride=1, pad=1)
res3d_branch2b_relu = ReLULayer(net, res3d_branch2b)
res3d_branch2c = FullyConnectedLayer(net, res3d_branch2b, 512)
res3d_relu = ReLULayer(net, res3d)
res4a_branch1 = FullyConnectedLayer(net, res3d, 1024)
res4a_branch2a = FullyConnectedLayer(net, res3d, 256)
res4a_branch2a_relu = ReLULayer(net, res4a_branch2a)
res4a_branch2b = ConvLayer(net, res4a_branch2a, num_filters=256, kernel=3, stride=1, pad=1)
res4a_branch2b_relu = ReLULayer(net, res4a_branch2b)
res4a_branch2c = FullyConnectedLayer(net, res4a_branch2b, 1024)
res4a_relu = ReLULayer(net, res4a)
res4b_branch2a = FullyConnectedLayer(net, res4a, 256)
res4b_branch2a_relu = ReLULayer(net, res4b_branch2a)
res4b_branch2b = ConvLayer(net, res4b_branch2a, num_filters=256, kernel=3, stride=1, pad=1)
res4b_branch2b_relu = ReLULayer(net, res4b_branch2b)
res4b_branch2c = FullyConnectedLayer(net, res4b_branch2b, 1024)
res4b_relu = ReLULayer(net, res4b)
res4c_branch2a = FullyConnectedLayer(net, res4b, 256)
res4c_branch2a_relu = ReLULayer(net, res4c_branch2a)
res4c_branch2b = ConvLayer(net, res4c_branch2a, num_filters=256, kernel=3, stride=1, pad=1)
res4c_branch2b_relu = ReLULayer(net, res4c_branch2b)
res4c_branch2c = FullyConnectedLayer(net, res4c_branch2b, 1024)
res4c_relu = ReLULayer(net, res4c)
res4d_branch2a = FullyConnectedLayer(net, res4c, 256)
res4d_branch2a_relu = ReLULayer(net, res4d_branch2a)
res4d_branch2b = ConvLayer(net, res4d_branch2a, num_filters=256, kernel=3, stride=1, pad=1)
res4d_branch2b_relu = ReLULayer(net, res4d_branch2b)
res4d_branch2c = FullyConnectedLayer(net, res4d_branch2b, 1024)
res4d_relu = ReLULayer(net, res4d)
res4e_branch2a = FullyConnectedLayer(net, res4d, 256)
res4e_branch2a_relu = ReLULayer(net, res4e_branch2a)
res4e_branch2b = ConvLayer(net, res4e_branch2a, num_filters=256, kernel=3, stride=1, pad=1)
res4e_branch2b_relu = ReLULayer(net, res4e_branch2b)
res4e_branch2c = FullyConnectedLayer(net, res4e_branch2b, 1024)
res4e_relu = ReLULayer(net, res4e)
res4f_branch2a = FullyConnectedLayer(net, res4e, 256)
res4f_branch2a_relu = ReLULayer(net, res4f_branch2a)
res4f_branch2b = ConvLayer(net, res4f_branch2a, num_filters=256, kernel=3, stride=1, pad=1)
res4f_branch2b_relu = ReLULayer(net, res4f_branch2b)
res4f_branch2c = FullyConnectedLayer(net, res4f_branch2b, 1024)
res4f_relu = ReLULayer(net, res4f)
res5a_branch1 = FullyConnectedLayer(net, res4f, 2048)
res5a_branch2a = FullyConnectedLayer(net, res4f, 512)
res5a_branch2a_relu = ReLULayer(net, res5a_branch2a)
res5a_branch2b = ConvLayer(net, res5a_branch2a, num_filters=512, kernel=3, stride=1, pad=1)
res5a_branch2b_relu = ReLULayer(net, res5a_branch2b)
res5a_branch2c = FullyConnectedLayer(net, res5a_branch2b, 2048)
res5a_relu = ReLULayer(net, res5a)
res5b_branch2a = FullyConnectedLayer(net, res5a, 512)
res5b_branch2a_relu = ReLULayer(net, res5b_branch2a)
res5b_branch2b = ConvLayer(net, res5b_branch2a, num_filters=512, kernel=3, stride=1, pad=1)
res5b_branch2b_relu = ReLULayer(net, res5b_branch2b)
res5b_branch2c = FullyConnectedLayer(net, res5b_branch2b, 2048)
res5b_relu = ReLULayer(net, res5b)
res5c_branch2a = FullyConnectedLayer(net, res5b, 512)
res5c_branch2a_relu = ReLULayer(net, res5c_branch2a)
res5c_branch2b = ConvLayer(net, res5c_branch2a, num_filters=512, kernel=3, stride=1, pad=1)
res5c_branch2b_relu = ReLULayer(net, res5c_branch2b)
res5c_branch2c = FullyConnectedLayer(net, res5c_branch2b, 2048)
res5c_relu = ReLULayer(net, res5c)
pool5 = MeanPoolingLayer(net, res5c, kernel=7, stride=1, pad=0)
fc1000 =  FullyConnectedLayer(net, pool5, 1000)
prob = SoftmaxLossLayer(net, fc1000)
