code: def test_matrix_and_mvn_to_funsor(
      batch_shape, event_shape, x_size, y_size
  ):
      matrix = torch.randn(batch_shape + event_shape + (x_size, y_size))
      y_mvn = random_mvn(batch_shape + event_shape, y_size)
      xy_mvn = random_mvn(batch_shape + event_shape, x_size + y_size)
      int_inputs = OrderedDict(
          (k, Bint[size]) for k, size in zip("abc", event_shape)
      )
      real_inputs = OrderedDict(
          [("x", Reals[x_size]), ("y", Reals[y_size])]
      )
  
      f1 = matrix_and_mvn_to_funsor(
          matrix, y_mvn, tuple(int_inputs), "x", "y"
      )
      f2 = mvn_to_funsor(xy_mvn, tuple(int_inputs), real_inputs)
      f = f1 + f2
      assert isinstance(f, Funsor)
      for k, d in int_inputs.items():
          if d.num_elements == 1:
              assert d not in f.inputs
          else:
              assert k in f.inputs
              assert f.inputs[k] == d
      assert f.inputs["x"] == Reals[x_size]
      assert f.inputs["y"] == Reals[y_size]
  
      xy = torch.randn(x_size + y_size)
      x, y = xy[:x_size], xy[x_size:]
      y_pred = x.unsqueeze(-2).matmul(matrix).squeeze(-2)
      actual_log_prob = f(x=x, y=y)
  
      expected_log_prob = f1(x=x, y=y) + f2(x=x, y=y)
      assert_close(
          actual_log_prob, expected_log_prob, atol=1e-4, rtol=1e-4
      )
  
      expected_log_prob = tensor_to_funsor(
          xy_mvn.log_prob(xy) + y_mvn.log_prob(y - y_pred),
          tuple(int_inputs),
      )
      assert_close(
          actual_log_prob, expected_log_prob, atol=1e-4, rtol=1e-4
      )
  
imports: from collections import OrderedDict
  import pyro.distributions
  import pytest
  import torch
  from pyro.distributions.torch_distribution import MaskedDistribution
  from funsor.domains import Bint, Reals
  from funsor.pyro.convert import dist_to_funsor, funsor_to_cat_and_mvn, funsor_to_mvn, funsor_to_tensor, matrix_and_mvn_to_funsor, mvn_to_funsor, tensor_to_funsor
  from funsor.tensor import Tensor
  from funsor.terms import Funsor
  from funsor.testing import assert_close, random_mvn
label_desc: Use image node_id 3 for calling a global function with example usage: test_matrix_and_mvn_to_funsor(batch_shape, event_shape, x_size, y_size) without return types