code: def _einsum_helper(g: jit_utils.GraphContext, equation, tensors):
      if not tensors:
          raise RuntimeError("Einsum inputs are empty.")
      # ONNX does not support bool for Einsum inputs.
      if symbolic_helper._is_bool(tensors[0]):
          tensors = [
              g.op(
                  "Cast", tensor, to_i=_C_onnx.TensorProtoDataType.INT64
              )
              for tensor in tensors
          ]
          return g.op(
              "Cast",
              g.op("Einsum", *tensors, equation_s=equation),
              to_i=_C_onnx.TensorProtoDataType.BOOL,
          )
      else:
          return g.op("Einsum", *tensors, equation_s=equation)
  
imports: from __future__ import annotations
  import functools
  import sys
  from typing import Optional, Tuple
  import torch
  from torch._C import _onnx
  from torch.onnx import _type_utils, errors, symbolic_helper, symbolic_opset9, utils
  from torch.onnx._internal import _beartype, jit_utils, registration
label_desc: Use image node_id 1 for calling a global function with example usage: _einsum_helper(g, equation, tensors) and returns: g, g