@kullback_leibler.RegisterKL(Blockwise, Blockwise)<EOL>def _kl_blockwise_blockwise(b0, b1, name=None):
if len(b0.distributions) != len(b1.distributions):<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>b0_event_sizes = [_event_size(d) for d in b0.distributions]<EOL>b1_event_sizes = [_event_size(d) for d in b1.distributions]<EOL>assertions = []<EOL>message = ('<STR_LIT>'<EOL>'<STR_LIT>')<EOL>if (all(isinstance(event_size, int) for event_size in b0_event_sizes) and<EOL>all(isinstance(event_size, int) for event_size in b1_event_sizes)):<EOL><INDENT>if b0_event_sizes != b1_event_sizes:<EOL><INDENT>raise ValueError(message)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if b0.validate_args or b1.validate_args:<EOL><INDENT>assertions.extend(<EOL>assert_util.assert_equal(  <EOL>e1, e2, message=message)<EOL>for e1, e2 in zip(b0_event_sizes, b1_event_sizes))<EOL><DEDENT><DEDENT>with tf.name_scope(name or '<STR_LIT>'):<EOL><INDENT>with tf.control_dependencies(assertions):<EOL><INDENT>return sum([<EOL>kullback_leibler.kl_divergence(d1, d2) for d1, d2 in zip(<EOL>b0.distributions, b1.distributions)])<EOL><DEDENT><DEDENT>
Calculate the batched KL divergence KL(b0 || b1) with b0 and b1 Blockwise distributions.

    Args:
      b0: instance of a Blockwise distribution object.
      b1: instance of a Blockwise distribution object.
      name: (optional) Name to use for created operations. Default is
        "kl_blockwise_blockwise".

    Returns:
      kl_blockwise_blockwise: `Tensor`. The batchwise KL(b0 || b1).