code: def test_chaining():
      X = (
          Uniform(0, 1)
          .rv.add(1)  # (0, 1)  # (1, 2)
          .pow(2)  # (1, 4)
          .mul(2)  # (2, 8)
          .sub(5)  # (-3, 3)
          .tanh()  # (-1, 1); more like (-0.995, +0.995)
          .exp()  # (1/e, e)
      )
      x = X.dist.sample([N_SAMPLES])
      assert ((1 / math.e <= x) & (x <= math.e)).all().item()
  
file_path: pyro/tests/contrib/randomvariable/test_random_variable.py
imports: import math
  import torch
  from pyro.distributions import Uniform
label_desc: Use image node_id 8 for calling a global function with example usage: test_chaining() without return types