code: def make_log_det_jacobian_fn(bijector, direction):
      """Makes a function which applies a list of Bijectors' `log_det_jacobian`s."""
      attr = "{}_log_det_jacobian".format(direction)
      if not mcmc_util.is_list_like(bijector):
          dtype = getattr(bijector, "{}_dtype".format(direction))()
          if mcmc_util.is_list_like(dtype):
  
              def multipart_fn(state_parts, event_ndims):
                  return getattr(bijector, attr)(
                      state_parts, event_ndims
                  )
  
              return multipart_fn
          elif tf.nest.is_nested(dtype):
              raise ValueError(
                  "Only list-like multi-part bijectors are currently supported, but "
                  "got {}.".format(
                      tf.nest.map_structure(lambda _: ".", dtype)
                  )
              )
          bijector = [bijector]
  
      def fn(state_parts, event_ndims):
          return sum(
              getattr(b, attr)(sp, event_ndims=e)
              for b, e, sp in zip(bijector, event_ndims, state_parts)
          )
  
      return fn
  
imports: import collections
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.mcmc import kernel
  from tensorflow_probability.python.mcmc.internal import util
  from tensorflow.python.util import deprecation
label_desc: Use image node_id 1 for calling a global function with example usage: make_log_det_jacobian_fn(bijector, direction) and returns: fn, sum, multipart_fn, getattr