code: def test_rexpand():
      A = torch.tensor([[1.0, 2.0], [-2.0, 0]])
      assert_equal(rexpand(A), A, prec=1e-8)
      assert_equal(
          rexpand(A, 4), A.unsqueeze(-1).expand(2, 2, 4), prec=1e-8
      )
      assert_equal(
          rexpand(A, 4, 2),
          A.unsqueeze(-1).unsqueeze(-1).expand(2, 2, 4, 2),
          prec=1e-8,
      )
  
file_path: pyro/tests/contrib/test_util.py
imports: from collections import OrderedDict
  import pytest
  import torch
  from pyro.contrib.util import get_indices, lexpand, rdiag, rexpand, rmv, rtril, rvv, tensor_to_dict
  from tests.common import assert_equal
label_desc: Use image node_id 6 for calling a global function with example usage: test_rexpand() without return types