code: def test_doc_string(self):
      # Generate data -- as in Figure 1 in [Papamakarios et al. (2017)][1]).
      n = 2000
      x2 = np.random.randn(n) * 2.0
      x1 = np.random.randn(n) + (x2 * x2 / 4.0)
      data = np.stack([x1, x2], axis=-1)
  
      # Density estimation with MADE.
      model = tfk.Sequential(
          [
              # NOTE: This model takes no input and outputs a Distribution.  (We use
              # the batch_size and type of the input, but there are no actual input
              # values because the last dimension of the shape is 0.)
              #
              # For conditional density estimation, the model would take the
              # conditioning values as input.)
              tfkl.InputLayer(input_shape=(0,), dtype=tf.float32),
              # Given the empty input, return a standard normal distribution with
              # matching batch_shape and event_shape of [2].
              # pylint: disable=g-long-lambda
              distribution_layer.DistributionLambda(
                  lambda t: mvn_diag.MultivariateNormalDiag(
                      loc=tf.zeros(
                          tf.concat([tf.shape(t)[:-1], [2]], axis=0)
                      ),
                      scale_diag=[1.0, 1.0],
                  )
              ),
              # Transform the standard normal distribution with event_shape of [2] to
              # the target distribution with event_shape of [2].
              masked_autoregressive.AutoregressiveTransform(
                  masked_autoregressive_lib.AutoregressiveNetwork(
                      params=2, hidden_units=[10], activation="relu"
                  )
              ),
          ]
      )
  
      model.compile(
          optimizer="adam", loss=lambda y, rv_y: -rv_y.log_prob(y)
      )
  
      model.fit(
          x=np.zeros((n, 0)),
          y=data,
          batch_size=25,
          epochs=1,
          steps_per_epoch=1,  # Usually n // 25,
          verbose=True,
      )
  
      distribution = model(np.zeros((0,)))
      self.assertEqual(
          (4, 2), self.evaluate(distribution.sample(4)).shape
      )
      self.assertEqual(
          (5, 3),
          self.evaluate(
              distribution.log_prob(
                  np.zeros((5, 3, 2), dtype=np.float32)
              )
          ).shape,
      )
  
file_path: probability/tensorflow_probability/python/layers/masked_autoregressive_test.py
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import masked_autoregressive
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.internal import tf_keras
  from tensorflow_probability.python.layers import distribution_layer
  from tensorflow_probability.python.layers import masked_autoregressive
label_desc: Use image node_id 1 for calling the AutoregressiveTransformTest obj's underlying member method code with example usage: obj.test_doc_string() without return types