code: def assert_no_none_grad(bijector, method, wrt_vars, grads):
      for var, grad in zip(wrt_vars, grads):
          expect_grad = var.dtype not in (tf.int32, tf.int64)
          if "log_det_jacobian" in method:
              if tensor_util.is_ref(var):
                  # We check tensor_util.is_ref to account for xs/ys being in vars.
                  var_name = var.name.rstrip("_0123456789:").split("/")[
                      -1
                  ]
              else:
                  var_name = "[arg]"
              to_check = bijector
              while is_invert(to_check) or is_transform_diagonal(
                  to_check
              ):
                  to_check = (
                      to_check.bijector
                      if is_invert(to_check)
                      else to_check
                  )
                  to_check = (
                      to_check.diag_bijector
                      if is_transform_diagonal(to_check)
                      else to_check
                  )
              to_check_method = (
                  INVERT_LDJ[method] if is_invert(bijector) else method
              )
              if var_name == "[arg]" and bijector.is_constant_jacobian:
                  expect_grad = False
              exempt_var_method = NO_LDJ_GRADS_EXPECTED.get(
                  type(to_check).__name__, {}
              )
              if to_check_method in exempt_var_method.get(var_name, ()):
                  expect_grad = False
  
          if expect_grad != (grad is not None):
              raise AssertionError(
                  "{} `{}` -> {} grad for bijector {}".format(
                      "Missing" if expect_grad else "Unexpected",
                      method,
                      var,
                      bijector,
                  )
              )
  
imports: import collections
  import functools
  from absl.testing import parameterized
  import hypothesis
  from hypothesis import strategies
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python import bijectors
  from tensorflow_probability.python import util
  from tensorflow_probability.python.bijectors import hypothesis_testlib
  from tensorflow_probability.python.bijectors import invert
  from tensorflow_probability.python.internal import auto_composite_tensor
  from tensorflow_probability.python.internal import hypothesis_testlib
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import test_util
  from tensorflow.python.util import nest
label_desc: Use image node_id 9 for calling a global function with example usage: assert_no_none_grad(bijector, method, wrt_vars, grads) without return types