code: def test_invertible_from_trainable_lu_factorization(self):
      channels = 3
      lower_upper, permutation = trainable_lu_factorization(
          channels, seed=42
      )
      conv1x1 = scale_matvec_lu.ScaleMatvecLU(
          lower_upper, permutation, validate_args=True
      )
  
      self.assertIs(lower_upper, conv1x1.lower_upper)
      self.evaluate([v.initializer for v in conv1x1.variables])
  
      x = tf.random.uniform(shape=[2, 28, 28, channels])
  
      fwd = conv1x1.forward(x)
      rev_fwd = conv1x1.inverse(fwd)
      fldj = conv1x1.forward_log_det_jacobian(x, event_ndims=3)
  
      rev = conv1x1.inverse(x)
      fwd_rev = conv1x1.forward(rev)
      ildj = conv1x1.inverse_log_det_jacobian(x, event_ndims=3)
  
      [
          x_,
          fwd_,
          rev_,
          fwd_rev_,
          rev_fwd_,
          fldj_,
          ildj_,
      ] = self.evaluate([x, fwd, rev, fwd_rev, rev_fwd, fldj, ildj])
  
      self.assertAllClose(x_, fwd_rev_, atol=1e-3, rtol=1e-6)
      self.assertAllClose(x_, rev_fwd_, atol=1e-3, rtol=1e-6)
  
      self.assertEqual(fldj_, -ildj_)
      self.assertNear(0.0, fldj_, err=1e-3)
  
      # We now check that the bijector isn't simply the identity function. We do
      # this by checking that at least 50% of pixels differ by at least 10%.
      self.assertTrue(np.mean(np.abs(x_ - fwd_) > 0.1 * x_) > 0.5)
      self.assertTrue(np.mean(np.abs(x_ - rev_) > 0.1 * x_) > 0.5)
  
file_path: probability/tensorflow_probability/python/bijectors/scale_matvec_lu_test.py
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector_test_util
  from tensorflow_probability.python.bijectors import scale_matvec_lu
  from tensorflow_probability.python.internal import test_util
label_desc: Use image node_id 1 for calling the ScaleMatvecLUTest obj's underlying member method code with example usage: obj.test_invertible_from_trainable_lu_factorization() without return types