code: def test_trainable_bijectors(self, cls, batch_and_event_shape):
      init_fn, apply_fn = trainable.make_trainable_stateless(
          cls,
          batch_and_event_shape=batch_and_event_shape,
          validate_args=True,
      )
  
      # Verify expected number of trainable variables.
      raw_parameters = init_fn(seed=test_util.test_seed())
      bijector = apply_fn(raw_parameters)
      self.assertLen(
          raw_parameters,
          len(
              [
                  k
                  for k, p in bijector.parameter_properties().items()
                  if p.is_tensor and p.is_preferred
              ]
          ),
      )
      # Verify gradients to all parameters.
      x = self.evaluate(
          samplers.normal(
              batch_and_event_shape, seed=test_util.test_seed()
          )
      )
      y, grad = gradient.value_and_gradient(
          lambda params: apply_fn(params).forward(x), [raw_parameters]
      )
      self.assertAllNotNone(grad)
  
      # Verify that the round trip doesn't broadcast, i.e., that it preserves
      # batch_and_event_shape.
      self.assertAllCloseNested(
          x,
          bijector.inverse(tf.identity(y)),  # Disable bijector cache.
          atol=1e-2,
      )
  
imports: from absl.testing import parameterized
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import fill_scale_tril
  from tensorflow_probability.python.bijectors import identity
  from tensorflow_probability.python.bijectors import scale
  from tensorflow_probability.python.bijectors import scale_matvec_tril
  from tensorflow_probability.python.bijectors import softplus
  from tensorflow_probability.python.distributions import dirichlet
  from tensorflow_probability.python.distributions import gamma
  from tensorflow_probability.python.distributions import geometric
  from tensorflow_probability.python.distributions import kumaraswamy
  from tensorflow_probability.python.distributions import mvn_tril
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import poisson
  from tensorflow_probability.python.distributions import wishart
  from tensorflow_probability.python.experimental.util import trainable
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.internal import tf_keras
  from tensorflow_probability.python.math import gradient
  from tensorflow_probability.python.math.minimize import minimize
  from tensorflow_probability.python.math.minimize import minimize_stateless
label_desc: Use image node_id 2 for calling the TestStatelessTrainableDistributionsAndBijectors obj's underlying member method code with example usage: obj.test_trainable_bijectors(cls, batch_and_event_shape) without return types