code: def mvn_to_funsor(
      pyro_dist, event_inputs=(), real_inputs=OrderedDict()
  ):
      """
      Convert a joint :class:`torch.distributions.MultivariateNormal`
      distribution into a :class:`~funsor.terms.Funsor` with multiple real
      inputs.
  
      This should satisfy::
  
          sum(d.num_elements for d in real_inputs.values())
            == pyro_dist.event_shape[0]
  
      :param torch.distributions.MultivariateNormal pyro_dist: A
          multivariate normal distribution over one or more variables
          of real or vector or tensor type.
      :param tuple event_inputs: A tuple of names for rightmost dimensions.
          These will be assigned to ``result.inputs`` of type ``Bint``.
      :param OrderedDict real_inputs: A dict mapping real variable name
          to appropriately sized ``Real``. The sum of all ``.numel()``
          of all real inputs should be equal to the ``pyro_dist`` dimension.
      :return: A funsor with given ``real_inputs`` and possibly additional
          Bint inputs.
      :rtype: funsor.terms.Funsor
      """
      assert isinstance(
          pyro_dist, torch.distributions.MultivariateNormal
      )
      assert isinstance(event_inputs, tuple)
      assert isinstance(real_inputs, OrderedDict)
      dim_to_name = default_dim_to_name(
          pyro_dist.batch_shape, event_inputs
      )
      funsor_dist = to_funsor(pyro_dist, Real, dim_to_name)
      if len(real_inputs) == 0:
          return funsor_dist
      discrete, gaussian = funsor_dist(value="value").terms
      inputs = OrderedDict(
          (k, v)
          for k, v in gaussian.inputs.items()
          if v.dtype != "real"
      )
      inputs.update(real_inputs)
      return discrete + Gaussian(
          white_vec=gaussian.white_vec,
          prec_sqrt=gaussian.prec_sqrt,
          inputs=inputs,
      )
  
imports: import math
  from collections import OrderedDict
  import torch
  import funsor.ops
  from funsor.cnf import Contraction
  from funsor.delta import Delta
  from funsor.domains import Array, Bint, Real, Reals
  from funsor.gaussian import Gaussian
  from funsor.interpreter import gensym
  from funsor.tensor import Tensor
  from funsor.terms import Independent, Variable, to_data, to_funsor
label_desc: Use image node_id 6 for calling a global function with example usage: mvn_to_funsor(pyro_dist, event_inputs, real_inputs) and returns: unknown, funsor_dist