def _gen_offsets(F, dcn_kernel=3, dcn_pad=1):
    """ Generate offset for deformable convolutions.
    :param dcn_kernel: the kernel of deformable convolutions
    :param dcn_pad: the padding of deformable convolutions
    :return: the offsets
    """
    dcn_base = F.arange(-dcn_pad, dcn_pad + 1)
    dcn_base_y = F.repeat(dcn_base, dcn_kernel)
    dcn_base_x = F.tile(dcn_base, dcn_kernel)
    dcn_base_offset = F.reshape(F.stack(dcn_base_y, dcn_base_x, axis=1), (1, -1, 1, 1))
    return dcn_base_offset