class_docstr: Tests the correctness of the Y = Chain(bij1, bij2, bij3) transformation.
code: def testDofChangeError(self):
      e = exp.Exp()
      smc = softmax_centered.SoftmaxCentered()
  
      # Increase in event-size is the last step. No problems here.
      safe_bij = chain.Chain(
          [smc, e], validate_args=True, validate_event_size=True
      )
      self.evaluate(
          safe_bij.forward_log_det_jacobian([1.0, 2.0, 3.0], 1)
      )
  
      # Increase in event-size before Exp.
      raise_bij = chain.Chain(
          [e, smc], validate_args=True, validate_event_size=True
      )
      with self.assertRaisesRegex(
          (ValueError, tf.errors.InvalidArgumentError),
          r".+degrees of freedom.+",
      ):
          self.evaluate(
              raise_bij.forward_log_det_jacobian([1.0, 2.0, 3.0], 1)
          )
  
      # When validate_args is False, warns instead of raising.
      warn_bij = chain.Chain(
          [e, smc], validate_args=False, validate_event_size=True
      )
      with mock.patch.object(
          tf, "print", return_value=tf.no_op()
      ) as mock_print:
          self.evaluate(
              warn_bij.forward_log_det_jacobian([1.0, 2.0, 3.0], 1)
          )
          print_args, _ = mock_print.call_args
          self.assertRegex(
              print_args[0], r"WARNING:.+degrees of freedom"
          )
  
      # When validate_event_shape is False, neither warns nor raises.
      ignore_bij = chain.Chain([e, smc], validate_event_size=False)
      self.evaluate(
          ignore_bij.forward_log_det_jacobian([1.0, 2.0, 3.0], 1)
      )
  
imports: import mock
  import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector
  from tensorflow_probability.python.bijectors import bijector_test_util
  from tensorflow_probability.python.bijectors import chain
  from tensorflow_probability.python.bijectors import exp
  from tensorflow_probability.python.bijectors import identity
  from tensorflow_probability.python.bijectors import inline
  from tensorflow_probability.python.bijectors import invert
  from tensorflow_probability.python.bijectors import joint_map
  from tensorflow_probability.python.bijectors import restructure
  from tensorflow_probability.python.bijectors import scale
  from tensorflow_probability.python.bijectors import scale_matvec_diag
  from tensorflow_probability.python.bijectors import softmax_centered
  from tensorflow_probability.python.bijectors import softplus
  from tensorflow_probability.python.bijectors import split
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import test_util
label_desc: Use image node_id 18 for calling the ChainBijectorTest obj's underlying member method code with example usage: obj.testDofChangeError() without return types