code: def test_can_call_ordereddict_log_prob_with_args_and_kwargs(
      self, model_fn
  ):
      # With an OrderedDict, we can pass keyword and/or positional args.
      d = jdn.JointDistributionNamed(model_fn(), validate_args=True)
  
      # Destructure vector-valued Tensors into Python lists, to mimic the values
      # a user might type.
      def _convert_ndarray_to_list(x):
          if isinstance(x, np.ndarray) and x.ndim > 0:
              return list(x)
          return x
  
      sample = tf.nest.map_structure(
          _convert_ndarray_to_list,
          self.evaluate(d.sample(seed=test_util.test_seed())),
      )
      sample_dict = dict(sample)
  
      lp_value_positional = self.evaluate(d.log_prob(sample_dict))
      lp_value_named = self.evaluate(d.log_prob(value=sample_dict))
      self.assertAllClose(lp_value_positional, lp_value_named)
  
      lp_args = self.evaluate(d.log_prob(*sample.values()))
      self.assertAllClose(lp_value_positional, lp_args)
  
      lp_kwargs = self.evaluate(d.log_prob(**sample_dict))
      self.assertAllClose(lp_value_positional, lp_kwargs)
  
      lp_args_then_kwargs = self.evaluate(
          d.log_prob(
              *list(sample.values())[:1],
              **dict(list(sample.items())[1:]),
          )
      )
      self.assertAllClose(lp_value_positional, lp_args_then_kwargs)
  
imports: import collections
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector_test_util
  from tensorflow_probability.python.bijectors import scale
  from tensorflow_probability.python.distributions import bernoulli
  from tensorflow_probability.python.distributions import beta
  from tensorflow_probability.python.distributions import exponential
  from tensorflow_probability.python.distributions import gamma
  from tensorflow_probability.python.distributions import half_normal
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import joint_distribution_named
  from tensorflow_probability.python.distributions import joint_distribution_sequential
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.distributions import lognormal
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import sample
  from tensorflow_probability.python.distributions import student_t
  from tensorflow_probability.python.distributions import transformed_distribution
  from tensorflow_probability.python.internal import test_util
label_desc: Use image node_id 6 for calling the JointDistributionNamedTest obj's underlying member method code with example usage: obj.test_can_call_ordereddict_log_prob_with_args_and_kwargs(model_fn) and returns: x, list