def _create_linear_layer(x, w, bias):
    """
    Utility to translate linear layer.
    Since the linear layer can only take `const` or `constexpr_` weight as input,
    for other cases, we implement the linear layer through matmul.

    For instance, given a torch model with an int8 weight:

    int8_weight -> transpose -> reshape -> linear

    If we directly use `mb.linear`, it is going to produce compilation error at the runtime.
    """
    if _is_const(w) and _is_const(bias, optional=True):
        return mb.linear(x=x, weight=w, bias=bias)
    res = mb.matmul(x=x, y=w, transpose_y=True)
    if bias is not None:
        res = mb.add(x=res, y=bias)
    return res

    Utility to translate linear layer.
    Since the linear layer can only take `const` or `constexpr_` weight as input,
    for other cases, we implement the linear layer through matmul.

    For instance, given a torch model with an int8 weight:

    int8_weight -> transpose -> reshape -> linear

    If we directly use `mb.linear`, it is going to produce compilation error at the runtime.
    
coremltools/converters/mil/frontend/torch/ops.py