def genRes5(train_val, last_top, small, i, fix_dim):
    prefix = 'res5.{i}.'.format(i=str(i))
    branch_str = ''
    res_last_top = last_top
    branch_last_top = last_top
    if small:
        (branch_str, branch_last_top) = genConvBnReluLayer(train_val=branch_str, name='{}conv1'.format(prefix), bottom=branch_last_top, kernel_size=3, num_output=512, stride=(2 if (i == 1) else 1), pad=1)
        (branch_str, branch_last_top) = genConvBnLayer(train_val=branch_str, name='{}conv2'.format(prefix), bottom=branch_last_top, kernel_size=3, num_output=512, stride=1, pad=1)
    else:
        (branch_str, branch_last_top) = genConvBnReluLayer(train_val=branch_str, name='{}conv1'.format(prefix), bottom=branch_last_top, kernel_size=1, num_output=512, stride=(2 if (i == 1) else 1), pad=0)
        (branch_str, branch_last_top) = genConvBnReluLayer(train_val=branch_str, name='{}conv2'.format(prefix), bottom=branch_last_top, kernel_size=3, num_output=512, stride=1, pad=1)
        (branch_str, branch_last_top) = genConvBnLayer(train_val=branch_str, name='{}conv3'.format(prefix), bottom=branch_last_top, kernel_size=1, num_output=2048, stride=1, pad=0)
    if fix_dim:
        (branch_str, res_last_top) = genConvBnLayer(train_val=branch_str, name='{}skipConv'.format(prefix), bottom=res_last_top, kernel_size=1, num_output=(512 if small else 2048), stride=2, pad=0)
    (branch_str, last_top) = genEltwiseLayer(train_val=branch_str, name='{}eltwise'.format(prefix), bottom_1=branch_last_top, bottom_2=res_last_top, operation='SUM')
    (branch_str, last_top) = genActivationLayer(train_val=branch_str, name='{}relu'.format(prefix), bottom=last_top)
    train_val += branch_str
    return (train_val, last_top)
def genRes5(train_val, last_top, small, i, fix_dim):
    prefix = 'res5.{i}.'.format(i=str(i))
    branch_str = 
    res_last_top = last_top
    branch_last_top = last_top
    if small:
        (branch_str, branch_last_top) = genConvBnReluLayer(train_val=branch_str, name='{}conv1'.format(prefix), bottom=branch_last_top, kernel_size=3, num_output=512, stride=(2 if (i == 1) else 1), pad=1)
        (branch_str, branch_last_top) = genConvBnLayer(train_val=branch_str, name='{}conv2'.format(prefix), bottom=branch_last_top, kernel_size=3, num_output=512, stride=1, pad=1)
    else:
        (branch_str, branch_last_top) = genConvBnReluLayer(train_val=branch_str, name='{}conv1'.format(prefix), bottom=branch_last_top, kernel_size=1, num_output=512, stride=(2 if (i == 1) else 1), pad=0)
        (branch_str, branch_last_top) = genConvBnReluLayer(train_val=branch_str, name='{}conv2'.format(prefix), bottom=branch_last_top, kernel_size=3, num_output=512, stride=1, pad=1)
        (branch_str, branch_last_top) = genConvBnLayer(train_val=branch_str, name='{}conv3'.format(prefix), bottom=branch_last_top, kernel_size=1, num_output=2048, stride=1, pad=0)
    if fix_dim:
        (branch_str, res_last_top) = genConvBnLayer(train_val=branch_str, name='{}skipConv'.format(prefix), bottom=res_last_top, kernel_size=1, num_output=(512 if small else 2048), stride=2, pad=0)
    (branch_str, last_top) = genEltwiseLayer(train_val=branch_str, name='{}eltwise'.format(prefix), bottom_1=branch_last_top, bottom_2=res_last_top, operation='SUM')
    (branch_str, last_top) = genActivationLayer(train_val=branch_str, name='{}relu'.format(prefix), bottom=last_top)
    train_val += branch_str
    return (train_val, last_top)