def gen_at_globalpool(code_block, name, in_q, out_q, in_dim, out_dim, at_globalpool, gen_ctrl=None, at_ver=3):
    if (gen_ctrl is None):
        gen_ctrl = '0'
    else:
        raise NotImplementedError('genctrl is not yet implemented')
    if (at_ver < 3):
        code_block.write('{}("{}", {}, {}, {}, 1, 1, {}, {}, {}, {}, {});', GEN_GLOBALPOOL, name, gen_ctrl, at_bits(in_q), at_bits(out_q), in_dim.shape[0], out_dim.shape[0], in_dim.shape[1], in_dim.shape[2], at_globalpool.GlobalPoolOper)
    else:
        code_block.write('{}("{}", {}, {}, {}, {}, {}, 1, 1, {}, {}, {}, {}, {});', GEN_GLOBALPOOL, name, gen_ctrl, at_bits(in_q), at_bits(out_q), in_q.q, out_q.q, in_dim.shape[0], out_dim.shape[0], in_dim.shape[1], in_dim.shape[2], at_globalpool.GlobalPoolOper)
def gen_at_globalpool(code_block, name, in_q, out_q, in_dim, out_dim, at_globalpool, gen_ctrl=None, at_ver=3):
    if (gen_ctrl is None):
        gen_ctrl = '0'
    else:
        raise NotImplementedError('genctrl is not yet implemented')
    if (at_ver < 3):
        code_block.write('{}("{}", {}, {}, {}, 1, 1, {}, {}, {}, {}, {});', GEN_GLOBALPOOL, name, gen_ctrl, at_bits(in_q), at_bits(out_q), in_dim.shape[0], out_dim.shape[0], in_dim.shape[1], in_dim.shape[2], at_globalpool.GlobalPoolOper)
    else:
        code_block.write('{}("{}", {}, {}, {}, {}, {}, 1, 1, {}, {}, {}, {}, {});', GEN_GLOBALPOOL, name, gen_ctrl, at_bits(in_q), at_bits(out_q), in_q.q, out_q.q, in_dim.shape[0], out_dim.shape[0], in_dim.shape[1], in_dim.shape[2], at_globalpool.GlobalPoolOper)