def _choose_conv2d_op(
    stride: int,
    pad: int,
    dilate: int,
    x: AITTensor,
    weight: AITTensor,
    bias: [AITTensor],
    transposed: [bool] = False,
) -> ConverterOutput:
    """
    Helper to choose conv2d vs. conv2d_bias op based on existence of bias
    and pad channel input dim to 4/8
    """
    if transposed:
        if bias:
            return transposed_conv2d_bias(stride=stride, pad=pad, dilate=dilate)(
                x, weight, bias
            )
        else:
            return transposed_conv2d(stride=stride, pad=pad, dilate=dilate)(x, weight)

    last_dim = x._attrs["shape"][-1]._attrs["values"][0]
    # CUDA conv channel dim weights need to align w/ a multiple of 2/4/8
    # if CI < 4, pad to 4; if 5 < CI < 8, pad to 8;
    if last_dim < 4:
        weight = pad_last_dim(len(weight._attrs["shape"]), 4)(weight)
        x = pad_last_dim(len(x._attrs["shape"]), 4)(x)
    elif last_dim in range(5, 8):
        to_8 = nhwc3to8()
        weight = to_8(weight)
        x = to_8(x)
    elif last_dim % 2 != 0:
        return RuntimeError(
            f"Conv2d is not implemented for input channel dim {last_dim}: it needs to be aligned to a multiple of 2/4/8"
        )
    if bias:
        return conv2d_bias(stride=stride, pad=pad, dilate=dilate)(x, weight, bias)
    else:
        return conv2d(stride=stride, pad=pad, dilate=dilate)(x, weight)
Helper to choose conv2d vs. conv2d_bias op based on existence of bias
and pad channel input dim to 4/8
fx2ait/fx2ait/converters/aten2ait_converters.py