code: def test_normalize_einsum(equation, plates, backend, einsum_impl):
      if get_backend() == "torch":
          import torch  # noqa: F401
  
      (
          inputs,
          outputs,
          sizes,
          operands,
          funsor_operands,
      ) = make_einsum_example(equation)
  
      with reflect:
          expr = einsum_impl(
              equation, *funsor_operands, backend=backend, plates=plates
          )
  
      with normalize:
          transformed_expr = reinterpret(expr)
  
      assert isinstance(transformed_expr, Contraction)
      check_funsor(transformed_expr, expr.inputs, expr.output)
  
      assert all(
          isinstance(v, (Number, Tensor, Contraction))
          for v in transformed_expr.terms
      )
  
      with normalize:
          transformed_expr2 = reinterpret(transformed_expr)
  
      assert (
          transformed_expr2 is transformed_expr
      )  # check normalization
  
      with eager:
          actual = reinterpret(transformed_expr)
          expected = reinterpret(expr)
  
      assert_close(actual, expected, rtol=1e-4)
  
      actual = eval(quote(expected))  # requires torch, Bint
      assert_close(actual, expected)
  
imports: import itertools
  from collections import OrderedDict
  import numpy
  import pytest
  from funsor import ops
  from funsor.cnf import BACKEND_TO_EINSUM_BACKEND, BACKEND_TO_LOGSUMEXP_BACKEND, Contraction
  from funsor.constant import Constant
  from funsor.delta import Delta
  from funsor.domains import Array, Bint, Real, Reals
  from funsor.einsum import einsum, naive_plated_einsum
  from funsor.integrate import Integrate
  from funsor.interpretations import eager, normalize, reflect
  from funsor.interpreter import reinterpret
  from funsor.optimizer import apply_optimizer
  from funsor.tensor import Tensor
  from funsor.terms import Number
  from funsor.testing import assert_close, check_funsor, make_einsum_example, random_tensor
  from funsor.util import get_backend, quote
label_desc: Use image node_id 1 for calling a global function with example usage: test_normalize_einsum(equation, plates, backend, einsum_impl) without return types