code: def testRefitDistribution(self):
      def dummy_sample_clipper(actions, state):
          del state
          return actions
  
      action_spec = {
          "continuous": tensor_spec.BoundedTensorSpec(
              [_ACTION_SIZE_CONTINUOUS], tf.float32, 0.0, 1.0
          ),
          "discrete": tensor_spec.BoundedTensorSpec(
              [_ACTION_SIZE_DISCRETE], tf.int32, 0, 1
          ),
      }
      sampler = qtopt_cem_actions_sampler_continuous_and_one_hot.GaussianActionsSampler(
          action_spec=action_spec,
          sample_clippers=[[], [dummy_sample_clipper]],
          sub_actions_fields=[["discrete"], ["continuous"]],
      )
  
      mean = tf.constant(_MEAN)
      var = tf.constant(_VAR)
      mean = {
          "continuous": tf.broadcast_to(
              mean, [_BATCH, _ACTION_SIZE_CONTINUOUS]
          ),
          "discrete": tf.zeros([_BATCH, _ACTION_SIZE_DISCRETE]),
      }
      var = {
          "continuous": tf.broadcast_to(
              var, [_BATCH, _ACTION_SIZE_CONTINUOUS]
          ),
          "discrete": tf.zeros([_BATCH, _ACTION_SIZE_DISCRETE]),
      }
      actions = sampler.sample_batch_and_clip(3, mean, var)
  
      # [B, M, A] = [2, 3, 3]
      actions["continuous"] = tf.constant(
          [
              [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [1.0, 1.0, 1.0]],
              [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [2.0, 2.0, 2.0]],
          ]
      )
  
      ind = tf.constant([[0, 0, 2], [1, 1, 2]])
  
      mean, var = sampler.refit_distribution_to(ind, actions)
  
      self.assertAllClose(
          self.evaluate(mean)["continuous"],
          np.array([[1.0, 1.0, 1.0], [2.0, 2.0, 2.0]]),
      )
      self.assertAllClose(
          self.evaluate(var)["continuous"],
          np.array([[0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]),
      )
  
file_path: agents/tf_agents/policies/samplers/qtopt_cem_actions_sampler_continuous_and_one_hot_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import tensorflow
  from tf_agents.policies.samplers import qtopt_cem_actions_sampler_continuous_and_one_hot
  from tf_agents.specs import tensor_spec
label_desc: Use image node_id 3 for calling the ActionsSamplerTest obj's underlying member method code with example usage: obj.testRefitDistribution() and returns: actions