code: def contract(equation, *operands, **kwargs):
      """
      Wrapper around :func:`opt_einsum.contract` that optionally uses Pyro's
      cheap optimizer and optionally caches contraction paths.
  
      :param bool cache_path: whether to cache the contraction path.
          Defaults to True.
      """
      backend = kwargs.pop("backend", "numpy")
      out = kwargs.pop("out", None)
      shapes = [tuple(t.shape) for t in operands]
      with ignore_jit_warnings():
          expr = contract_expression(equation, *shapes)
          return expr(*operands, backend=backend, out=out)
  
imports: import opt_einsum
  from pyro.util import ignore_jit_warnings
label_desc: Use image node_id 2 for calling a global function with example usage: contract(equation) and returns: expr