def genTrainVal(network):
    train_val = ''
    (train_val, last_top) = genDataLayer(train_val=train_val, number=network[0])
    train_val = addComment(train_val=train_val, comment='Res1')
    (train_val, last_top) = genConvBnReluLayer(train_val=train_val, name='conv1', bottom='data', kernel_size=7, num_output=64, stride=2, pad=3)
    (train_val, last_top) = genPoolLayer(train_val=train_val, name='pool1', bottom=last_top, kernel_size=3, stride=2, pool_type='MAX')
    train_val = addComment(train_val=train_val, comment='ResBlock2')
    for i in xrange(1, (network[2] + 1)):
        (train_val, last_top) = genRes2(train_val=train_val, last_top=last_top, small=(network[1] is 'small'), i=i, fix_dim=False)
    train_val = addComment(train_val=train_val, comment='ResBlock3')
    for i in xrange(1, (network[3] + 1)):
        (train_val, last_top) = genRes3(train_val=train_val, last_top=last_top, small=(network[1] is 'small'), i=i, fix_dim=(i == 1))
    train_val = addComment(train_val=train_val, comment='ResBlock4')
    for i in xrange(1, (network[4] + 1)):
        (train_val, last_top) = genRes4(train_val=train_val, last_top=last_top, small=(network[1] is 'small'), i=i, fix_dim=(i == 1))
    train_val = addComment(train_val=train_val, comment='ResBlock5')
    for i in xrange(1, (network[5] + 1)):
        (train_val, last_top) = genRes5(train_val=train_val, last_top=last_top, small=(network[1] is 'small'), i=i, fix_dim=(i == 1))
    (train_val, last_top) = genPoolLayer(train_val=train_val, name='pool2', bottom=last_top, kernel_size=7, stride=1, pool_type='AVE')
    (train_val, last_top) = genFCLayer(train_val=train_val, name='fc', bottom=last_top, num_output=1000, filler='msra')
    fc_top = last_top
    (train_val, last_top) = genSoftmaxLossLayer(train_val=train_val, name='loss', bottom_1=fc_top)
    (train_val, last_top) = genAccuracyLayer(train_val=train_val, name='accuracy/top-1', bottom_1=fc_top, k=1)
    (train_val, last_top) = genAccuracyLayer(train_val=train_val, name='accuracy/top-5', bottom_1=fc_top, k=5)
    return train_val
def genTrainVal(network):
    train_val = 
    (train_val, last_top) = genDataLayer(train_val=train_val, number=network[0])
    train_val = addComment(train_val=train_val, comment='Res1')
    (train_val, last_top) = genConvBnReluLayer(train_val=train_val, name='conv1', bottom='data', kernel_size=7, num_output=64, stride=2, pad=3)
    (train_val, last_top) = genPoolLayer(train_val=train_val, name='pool1', bottom=last_top, kernel_size=3, stride=2, pool_type='MAX')
    train_val = addComment(train_val=train_val, comment='ResBlock2')
    for i in xrange(1, (network[2] + 1)):
        (train_val, last_top) = genRes2(train_val=train_val, last_top=last_top, small=(network[1] is 'small'), i=i, fix_dim=False)
    train_val = addComment(train_val=train_val, comment='ResBlock3')
    for i in xrange(1, (network[3] + 1)):
        (train_val, last_top) = genRes3(train_val=train_val, last_top=last_top, small=(network[1] is 'small'), i=i, fix_dim=(i == 1))
    train_val = addComment(train_val=train_val, comment='ResBlock4')
    for i in xrange(1, (network[4] + 1)):
        (train_val, last_top) = genRes4(train_val=train_val, last_top=last_top, small=(network[1] is 'small'), i=i, fix_dim=(i == 1))
    train_val = addComment(train_val=train_val, comment='ResBlock5')
    for i in xrange(1, (network[5] + 1)):
        (train_val, last_top) = genRes5(train_val=train_val, last_top=last_top, small=(network[1] is 'small'), i=i, fix_dim=(i == 1))
    (train_val, last_top) = genPoolLayer(train_val=train_val, name='pool2', bottom=last_top, kernel_size=7, stride=1, pool_type='AVE')
    (train_val, last_top) = genFCLayer(train_val=train_val, name='fc', bottom=last_top, num_output=1000, filler='msra')
    fc_top = last_top
    (train_val, last_top) = genSoftmaxLossLayer(train_val=train_val, name='loss', bottom_1=fc_top)
    (train_val, last_top) = genAccuracyLayer(train_val=train_val, name='accuracy/top-1', bottom_1=fc_top, k=1)
    (train_val, last_top) = genAccuracyLayer(train_val=train_val, name='accuracy/top-5', bottom_1=fc_top, k=5)
    return train_val