code: def kl_divergence_monte_carlo(q, r, w):
      """Monte Carlo KL Divergence."""
      return expectation(
          lambda w: q.log_prob(w) - r.log_prob(w),
          samples=w,
          log_prob=q.log_prob,
          use_reparameterization=all(
              rt == FULLY_REPARAMETERIZED
              for rt in tf.nest.flatten(q.reparameterization_type)
          ),
          axis=(),
      )
  
file_path: probability/tensorflow_probability/python/experimental/nn/losses/losses.py
imports: import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.experimental.nn import layers
  from tensorflow_probability.python.experimental.nn import variational_base
  from tensorflow_probability.python.internal.reparameterization import FULLY_REPARAMETERIZED
  from tensorflow_probability.python.monte_carlo.expectation import expectation
label_desc: Use image node_id 1 for calling a global function with example usage: kl_divergence_monte_carlo(q, r, w) and returns: expectation