code: def test_nested_einsum_complete_sharing(
      eqn1, eqn2, einsum_impl1, einsum_impl2, backend1, backend2
  ):
      (
          inputs1,
          outputs1,
          sizes1,
          operands1,
          funsor_operands1,
      ) = make_einsum_example(eqn1, sizes=(3,))
      (
          inputs2,
          outputs2,
          sizes2,
          operands2,
          funsor_operands2,
      ) = make_einsum_example(eqn2, sizes=(3,))
  
      with memoize():
          output1_1 = einsum_impl1(
              eqn1, *funsor_operands1, backend=backend1
          )
          output2_1 = einsum_impl2(
              outputs1[0] + "," + eqn2,
              *([output1_1] + funsor_operands2),
              backend=backend2,
          )
  
          output1_2 = einsum_impl1(
              eqn1, *funsor_operands1, backend=backend1
          )
          output2_2 = einsum_impl2(
              outputs1[0] + "," + eqn2,
              *([output1_2] + funsor_operands2),
              backend=backend2,
          )
  
      assert output1_1 is output1_2
      assert output2_1 is output2_2
  
file_path: funsor/test/test_memoize.py
imports: import numpy
  import pytest
  import funsor.ops
  from funsor.cnf import BACKEND_TO_EINSUM_BACKEND, BACKEND_TO_LOGSUMEXP_BACKEND
  from funsor.einsum import einsum, naive_plated_einsum
  from funsor.interpretations import memoize
  from funsor.interpreter import reinterpret
  from funsor.tensor import numeric_array
  from funsor.terms import reflect
  from funsor.testing import excludes_backend, make_einsum_example, xfail_param
  from funsor.util import get_backend
label_desc: Use image node_id 5 for calling a global function with example usage: test_nested_einsum_complete_sharing(eqn1, eqn2, einsum_impl1, einsum_impl2, backend1, backend2) without return types