code: def _eager_contract_tensors(reduced_vars, terms, backend):
      iter_symbols = map(opt_einsum.get_symbol, itertools.count())
      symbols = defaultdict(functools.partial(next, iter_symbols))
  
      inputs = OrderedDict()
      einsum_inputs = []
      operands = []
      for term in terms:
          inputs.update(term.inputs)
          einsum_inputs.append(
              "".join(symbols[k] for k in term.inputs)
              + "".join(
                  symbols[i - len(term.shape)]
                  for i, size in enumerate(term.shape)
                  if size != 1
              )
          )
  
          # Squeeze absent event dims to be compatible with einsum.
          data = term.data
          batch_shape = data.shape[: len(data.shape) - len(term.shape)]
          event_shape = tuple(size for size in term.shape if size != 1)
          data = data.reshape(batch_shape + event_shape)
          operands.append(data)
  
      for var in reduced_vars:
          inputs.pop(var.name, None)
      batch_shape = tuple(v.size for v in inputs.values())
      event_shape = broadcast_shape(*(term.shape for term in terms))
      einsum_output = "".join(symbols[k] for k in inputs) + "".join(
          symbols[dim]
          for dim in range(-len(event_shape), 0)
          if dim in symbols
      )
      equation = ",".join(einsum_inputs) + "->" + einsum_output
      data = opt_einsum.contract(equation, *operands, backend=backend)
      data = data.reshape(batch_shape + event_shape)
      return Tensor(data, inputs)
  
imports: import functools
  import itertools
  from collections import Counter, OrderedDict, defaultdict
  from functools import reduce
  from typing import Tuple, Union
  import opt_einsum
  import funsor
  import funsor.ops
  from funsor.affine import affine_inputs
  from funsor.delta import Delta
  from funsor.domains import find_domain
  from funsor.gaussian import Gaussian
  from funsor.interpretations import eager, normalize, reflect
  from funsor.interpreter import children
  from funsor.ops import DISTRIBUTIVE_OPS, AssociativeOp, NullOp
  from funsor.tensor import Tensor
  from funsor.terms import _INFIX, Align, Binary, Funsor, Number, Reduce, Subs, Unary, Variable, to_funsor
  from funsor.typing import Variadic
  from funsor.util import broadcast_shape, get_backend, quote
label_desc: Use image node_id 10 for calling a global function with example usage: _eager_contract_tensors(reduced_vars, terms, backend) and returns: Tensor