code: def random_mvn(loc_shape, cov_shape, dim):
      """
      Generate a random MultivariateNormal distribution for testing.
      """
      rank = dim + dim
      loc = torch.randn(loc_shape + (dim,), requires_grad=True)
      cov = torch.randn(cov_shape + (dim, rank), requires_grad=True)
      cov = cov.matmul(cov.transpose(-1, -2))
      return MultivariateNormal(loc, cov)
  
imports: import pytest
  import torch
  from pyro.distributions import MultivariateNormal
  from tests.common import assert_equal
label_desc: Use image node_id 1 for calling a global function with example usage: random_mvn(loc_shape, cov_shape, dim) and returns: MultivariateNormal