code: def _kl_joint_joint(d0, d1, name=None):
      """Calculate the KL divergence between two `JointDistributionSequential`s.
  
      Args:
        d0: instance of a `JointDistributionSequential` object.
        d1: instance of a `JointDistributionSequential` object.
        name: (optional) Name to use for created operations.
          Default value: `"kl_joint_joint"`.
  
      Returns:
        kl_joint_joint: `Tensor` The sum of KL divergences between elemental
          distributions of two joint distributions.
  
      Raises:
        ValueError: when joint distributions have a different number of elemental
          distributions.
        ValueError: when either joint distribution has a distribution with dynamic
          dependency, i.e., when either joint distribution is not a collection of
          independent distributions.
      """
      if len(d0._dist_fn_wrapped) != len(
          d1._dist_fn_wrapped
      ):  # pylint: disable=protected-access
          raise ValueError(
              "Can only compute KL divergence between when each has the"
              "same number of component distributions."
          )
      if not all(
          a is None for a in d0._dist_fn_args
      ) or not all(  # pylint: disable=protected-access
          a is None for a in d1._dist_fn_args
      ):  # pylint: disable=protected-access
          raise ValueError(
              "Can only compute KL divergence when all distributions are "
              "independent."
          )
      with tf.name_scope(name or "kl_jointseq_jointseq"):
          return sum(
              kullback_leibler.kl_divergence(d0_(), d1_())
              for d0_, d1_ in zip(
                  d0._dist_fn_wrapped, d1._dist_fn_wrapped
              )
          )
  
imports: import collections
  import functools
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import joint_distribution
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.internal import auto_composite_tensor
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow.python.util import tf_inspect
label_desc: Use image node_id 5 for calling a global function with example usage: _kl_joint_joint(d0, d1, name) and returns: sum