class_docstr: Continuous Gaussian actions sampler.
  
  Supports nested action_spec with 1d continuous actions.
  
  Given a batch of distribution params(including mean and var), sample and
  return [B, N, A] actions, where 'B' means batch_size, 'N' means num_samples,
  'A' means action_size.
docstr: Refits distribution according to actions with index of ind.
  
  Args:
    target_sample_indices: A [B, M] sized tensor indicating the index
    samples: A nested structure corresponding to action_spec. Each action is a
      [B, N, A] sized tensor.
  
  Returns:
    mean: A nested structure containing [B, A] sized tensors where each row
      is the refitted mean.
    var: A nested structure containing  [B, A] sized tensors where each row
      is the refitted var.
docstr_tok: ["Refits","distribution","according","to","actions","with","index","of","ind",".","Args",":","target_sample_indices",":","A","[","B",",","M","]","sized","tensor","indicating","the","index","samples",":","A","nested","structure","corresponding","to","action_spec",".","Each","action","is","a","[","B",",","N",",","A","]","sized","tensor",".","Returns",":","mean",":","A","nested","structure","containing","[","B",",","A","]","sized","tensors","where","each","row","is","the","refitted","mean",".","var",":","A","nested","structure","containing","[","B",",","A","]","sized","tensors","where","each","row","is","the","refitted","var","."]
code: def refit_distribution_to(self, target_sample_indices, samples):
      """Refits distribution according to actions with index of ind.
  
      Args:
        target_sample_indices: A [B, M] sized tensor indicating the index
        samples: A nested structure corresponding to action_spec. Each action is a
          [B, N, A] sized tensor.
  
      Returns:
        mean: A nested structure containing [B, A] sized tensors where each row
          is the refitted mean.
        var: A nested structure containing  [B, A] sized tensors where each row
          is the refitted var.
      """
  
      def get_mean(best_samples):
          mean, _ = tf.nn.moments(
              best_samples, axes=1
          )  # mu, var: [B, A]
          return mean
  
      def get_var(best_samples):
          _, var = tf.nn.moments(
              best_samples, axes=1
          )  # mu, var: [B, A]
          return var
  
      best_samples = tf.nest.map_structure(
          lambda s: tf.gather(s, target_sample_indices, batch_dims=1),
          samples,
      )
      mean = tf.nest.map_structure(get_mean, best_samples)
      var = tf.nest.map_structure(get_var, best_samples)
  
      return mean, var
  
file_path: agents/tf_agents/policies/samplers/qtopt_cem_actions_sampler_continuous.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import gin
  import tensorflow
  import tensorflow_probability
  from tf_agents.policies.samplers import qtopt_cem_actions_sampler
  from tf_agents.specs import tensor_spec
  from tf_agents.utils import common
label_desc: Use image node_id 2 for calling the GaussianActionsSampler obj's underlying member method code with example usage: obj.refit_distribution_to(target_sample_indices, samples) and returns: mean,  var, mean, var