code: def testSliceSequencePreservesOrigVarGradLinkage(self):
      logits = tf.Variable(
          samplers.normal([20, 3, 1, 5], seed=test_util.test_seed())
      )
      self.evaluate(logits.initializer)
      dist = bernoulli.Bernoulli(logits=logits, validate_args=True)
      for slicer in [
          make_slicer[:5],
          make_slicer[..., -1],
          make_slicer[:, 1::2],
      ]:
          with tf.GradientTape() as tape:
              dist = slicer(dist)
              lp = dist.log_prob(0)
          dlpdlogits = tape.gradient(lp, logits)
          self.assertIsNotNone(dlpdlogits)
          self.assertGreater(
              self.evaluate(tf.reduce_sum(tf.abs(dlpdlogits))), 0
          )
  
imports: import numpy
  from scipy import special
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import bernoulli
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
label_desc: Use image node_id 3 for calling the BernoulliSlicingTest obj's underlying member method code with example usage: obj.testSliceSequencePreservesOrigVarGradLinkage() without return types