code: def get_distribution_params(
      nested_distribution: types.NestedDistribution,
      legacy_distribution_network: bool,
  ) -> types.NestedTensor:
      """Get the params for an optionally nested action distribution.
  
      Only returns parameters that have tf.Tensor values.
  
      Args:
        nested_distribution: The nest of distributions whose parameter tensors to
          extract.
        legacy_distribution_network: Whether this distribution was generated by a
          (legacy) `DistributionNetwork`.  If `False`, expect the distribution was
          generated by a regular Network object that emits distributions.
  
      Returns:
        A nest of distribution parameters. Each leaf is a dict corresponding to one
          distribution, with keys as parameter name and values as tensors containing
          parameter values.
      """
      if not legacy_distribution_network:
  
          def dist_params_dict(d):
              return distribution_utils.parameters_to_dict(
                  distribution_utils.get_parameters(d),
                  tensors_only=True,
              )
  
          return tf.nest.map_structure(
              dist_params_dict, nested_distribution
          )
  
      ## Legacy behavior below this line.
  
      def _maybe_scale(d, k):
          # For backwards compatibility with old DistributionNetworks, we rewrite
          # the 'scale_diag' of MVNDiag to 'scale'.
          if (
              isinstance(d, tfp.distributions.MultivariateNormalDiag)
              and k == "scale_diag"
          ):
              return "scale"
          else:
              return k
  
      def _tensor_parameters_only(d, params):
          return {
              _maybe_scale(d, k): params[k]
              for k in params
              if tf.is_tensor(params[k])
          }
  
      return tf.nest.map_structure(
          lambda d: _tensor_parameters_only(d, d.parameters),
          nested_distribution,
      )
  
file_path: agents/tf_agents/agents/ppo/ppo_utils.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from typing import Sequence
  import tensorflow
  import tensorflow_probability
  from tf_agents.distributions import utils
  from tf_agents.specs import distribution_spec
  from tf_agents.trajectories import policy_step
  from tf_agents.trajectories import time_step
  from tf_agents.trajectories import trajectory
  from tf_agents.typing import types
  from tf_agents.utils import nest_utils
label_desc: Use image node_id 4 for calling a global function with example usage: get_distribution_params(nested_distribution, legacy_distribution_network) and returns: tf, tf, unknown, distribution_utils, str, k