code: def _grads_assertions(self, grads, i, j):
      # Gradients of pixel output wrt pixels below are 0
      self.assertEqual((grads[0][i + 1 :] != 0).sum(), 0)
  
      # Gradients of pixel output wrt pixels above are nonzero
      self.assertEqual((grads[0][:i] == 0).sum(), 0)
  
      # Gradients of pixels output wrt pixels to the right in the same row are 0
      self.assertEqual((grads[0][i][j + 1 :] != 0.0).sum(), 0)
  
      # Gradients wrt pixels to the left in the same row is nonzero
      self.assertEqual((grads[0][i][:j] == 0.0).sum(), 0)
  
      # Gradients wrt pixels in different batches are zero
      self.assertEqual((grads[1] != 0.0).sum(), 0)
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import pixel_cnn
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.internal import tf_keras
  from tensorflow_probability.python.math import gradient
label_desc: Use image node_id 8 for calling the PixelCnnTest obj's underlying member method code with example usage: obj._grads_assertions(grads, i, j) without return types