def apply_gemm(scope, input_name, output_name, container, operator_name=None, alpha=1.0, beta=1.0,
               transA=0, transB=0):
    """
    Applies operator `gemm <https://github.com/onnx/onnx/blob/master/docs/Operators.md#gemm>`.
    """
    name = _create_name_or_use_existing_one(scope, 'Gemm', operator_name)
    attrs = {'alpha': alpha, 'beta': beta, 'transA': transA, 'transB': transB}
    if container.target_opset < 5:
        attrs['op_version'] = 1
        attrs['broadcast'] = 1
    elif container.target_opset < 7:
        attrs['op_version'] = 6
        attrs['broadcast'] = 1
    else:
        attrs['op_version'] = 7

    container.add_node('Gemm', input_name, output_name, name=name, **attrs)
Applies operator `gemm <https://github.com/onnx/onnx/blob/master/docs/Operators.md#gemm>`.