code: def _write_num_zeros(self)->None:
          "Writes the number of zeroes in the gradients to Tensorboard."
          gradient_nps = [to_np(x.data) for x in self.gradients]
          num_zeros = sum((np.asarray(x) == 0.0).sum() for x in gradient_nps)
          self._add_gradient_scalar('num_zeros', scalar_value=num_zerosf _write_num_zeros(self)->None:
          "Writes the number of zeroes in the gradients to Tensorboard."
          gradient_nps = [to_np(x.data) for x in self.gradients]
          num_zeros = sum((np.asarray(x) == 0.0).sum() for x in gradient_nps)
          self._add_gradient_scalar('num_zeros', scalar_value=num_zeros)
docs: Writes the number of zeroes in the gradients to Tensorboard.