code: def random_mvt(df_shape, loc_shape, cov_shape, dim):
      """
      Generate a random MultivariateStudentT distribution for testing.
      """
      rank = dim + dim
      df = torch.rand(df_shape, requires_grad=True).exp()
      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))
      scale_tril = torch.linalg.cholesky(cov)
      return MultivariateStudentT(df, loc, scale_tril)
  
file_path: pyro/tests/distributions/test_mvt.py
imports: import math
  import pytest
  import torch
  from torch.distributions import Gamma, MultivariateNormal, StudentT
  from pyro.distributions import MultivariateStudentT
  from tests.common import assert_equal
label_desc: Use image node_id 1 for calling a global function with example usage: random_mvt(df_shape, loc_shape, cov_shape, dim) and returns: MultivariateStudentT