code: def test_funsor_to_cat_and_mvn(
      batch_shape, event_shape, int_size, real_size
  ):
      logits = torch.randn(batch_shape + event_shape + (int_size,))
      expected_cat = dist.Categorical(logits=logits)
      expected_mvn = random_mvn(
          batch_shape + event_shape + (int_size,), real_size
      )
      event_dims = tuple("abc"[: len(event_shape)]) + ("component",)
      ndims = len(expected_cat.batch_shape)
  
      funsor_ = tensor_to_funsor(logits, event_dims) + dist_to_funsor(
          expected_mvn, event_dims
      )(value="value")
      assert isinstance(funsor_, Funsor)
  
      actual_cat, actual_mvn = funsor_to_cat_and_mvn(
          funsor_, ndims, event_dims
      )
      assert isinstance(actual_cat, dist.Categorical)
      assert isinstance(actual_mvn, dist.MultivariateNormal)
      assert actual_cat.batch_shape == expected_cat.batch_shape
      assert actual_mvn.batch_shape == expected_mvn.batch_shape
      assert_close(
          actual_cat.logits, expected_cat.logits, atol=1e-4, rtol=None
      )
      assert_close(
          actual_mvn.loc, expected_mvn.loc, atol=1e-4, rtol=None
      )
      assert_close(
          actual_mvn.precision_matrix,
          expected_mvn.precision_matrix,
          atol=1e-4,
          rtol=None,
      )
  
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 6 for calling a global function with example usage: test_funsor_to_cat_and_mvn(batch_shape, event_shape, int_size, real_size) without return types