code: def _parse_einsum_input(operands):
      """Parses einsum operands.
  
      This function is based on `numpy.core.einsumfunc._parse_einsum_input`
      function in NumPy 1.14.
  
      Returns
      -------
      input_strings : str
          Parsed input strings
      output_string : str
          Parsed output string
      operands : list of array_like
          The operands to use in the numpy contraction
  
      Examples
      --------
      The operand list is simplified to reduce printing:
  
      >>> a = np.random.rand(4, 4)
      >>> b = np.random.rand(4, 4, 4)
      >>> _parse_einsum_input(('...a,...a->...', a, b))
      ('@a,@a', '@', [a, b])
  
      >>> _parse_einsum_input((a, [Ellipsis, 0], b, [Ellipsis, 0]))
      ('@a,@a', '@', [a, b])
      """
  
      if not operands:
          raise ValueError("No input operands")
  
      if isinstance(operands[0], str):
          subscripts = operands[0].replace(" ", "")
          operands = operands[1:]
  
          # Ensure all characters are valid
          for s in subscripts:
              if s in ".,->":
                  continue
              if s not in einsum_symbols:
                  raise ValueError(
                      "Character %s is not a valid symbol." % s
                  )
  
          # Check for proper "->"
          if ("-" in subscripts) or (">" in subscripts):
              if any(
                  (
                      subscripts.count("-") > 1,
                      subscripts.count(">") > 1,
                      subscripts.count("->") != 1,
                  )
              ):
                  raise ValueError(
                      "Subscripts can only contain one '->'."
                  )
  
          # Parse "..."
          subscripts = subscripts.replace("...", "@")
          if "." in subscripts:
              raise ValueError("Invalid Ellipses.")
  
      else:
          tmp_operands = list(operands)
          operand_list = []
          subscript_list = []
          for p in range(len(operands) // 2):
              operand_list.append(tmp_operands.pop(0))
              subscript_list.append(tmp_operands.pop(0))
  
          output_list = tmp_operands[-1] if len(tmp_operands) else None
          operands = operand_list
          subscripts = ""
          last = len(subscript_list) - 1
          for num, sub in enumerate(subscript_list):
              for s in sub:
                  if s is Ellipsis:
                      subscripts += "@"
                  elif isinstance(s, int):
                      subscripts += einsum_symbols[s]
                  else:
                      raise TypeError(
                          "For this input type lists must contain "
                          "either int or Ellipsis"
                      )
              if num != last:
                  subscripts += ","
  
          if output_list is not None:
              subscripts += "->"
              for s in output_list:
                  if s is Ellipsis:
                      subscripts += "@"
                  elif isinstance(s, int):
                      subscripts += einsum_symbols[s]
                  else:
                      raise TypeError(
                          "For this input type lists must contain "
                          "either int or Ellipsis"
                      )
  
      # Build output string if does not exist
      if "->" in subscripts:
          input_subscripts, output_subscript = subscripts.split("->")
  
          # Make sure output subscripts are in the input
          for char in output_subscript:
              if char not in input_subscripts:
                  raise ValueError(
                      "Output character %s did not appear in the input"
                      % ("..." if char == "@" else char)
                  )
  
      else:
          input_subscripts = subscripts
          # Build output subscripts
          tmp_subscripts = subscripts.replace(",", "")
          output_subscript = ""
          for s in sorted(set(tmp_subscripts)):
              if s == "@" or tmp_subscripts.count(s) == 1:
                  output_subscript += s
  
      # Make sure number operands is equivalent to the number of terms
      if len(input_subscripts.split(",")) != len(operands):
          raise ValueError(
              "Number of einsum subscripts must be equal to the "
              "number of operands."
          )
  
      return input_subscripts, output_subscript, operands
  
imports: import warnings
  import chainer
  from chainer import backend
  from chainer.backends import cuda
  from chainer import function_node
  from chainer import utils
  from chainer.utils import argument
  from chainer.utils import type_check
label_desc: Use image node_id 4 for calling a global function with example usage: _parse_einsum_input(operands) and returns: input_subscripts,  output_subscript,  operands