class_docstr: Dummy 'proposal' distribution that just returns samples we pass in.
class_docstr_tok: ["Dummy","'proposal","'","distribution","that","just","returns","samples","we","pass","in","."]
code: def sample(self, sample_shape=(), seed=None, name=None):
      with tf.name_scope(name or "sample"):
          # Grab the required number of values from the provided tensors.
          sample_shape = dist_util.expand_to_vector(sample_shape)
          n = ps.cast(ps.reduce_prod(sample_shape), dtype=tf.int32)
  
          # Check that we're not trying to draw too many samples.
          assertions = []
          will_overflow_ = tf.get_static_value(n > self.max_num_samples)
          if will_overflow_:
              raise ValueError(
                  "Trying to draw {} samples from a "
                  "`DeterministicEmpirical` instance for which only {} "
                  "samples were provided.".format(
                      tf.get_static_value(n),
                      tf.get_static_value(self.max_num_samples),
                  )
              )
          elif (
              will_overflow_ is None  # Couldn't determine statically.
              and self.validate_args
          ):
              assertions.append(
                  tf.debugging.assert_less_equal(
                      n,
                      self.max_num_samples,
                      message="Number of samples to draw "
                      "from a `DeterministicEmpirical` instance must not exceed the "
                      "number provided at construction.",
                  )
              )
  
          # Extract the appropriate number of sampled values.
          with tf.control_dependencies(assertions):
              sampled = tf.nest.map_structure(
                  lambda x: x[:n, ...], self.values_with_sample_dim
              )
  
          # Reshape the values to the appropriate sample shape.
          return tf.nest.map_structure(
              lambda x: tf.reshape(
                  x,  # pylint: disable=g-long-lambda
                  ps.concat(
                      [
                          ps.cast(sample_shape, tf.int32),
                          ps.cast(ps.shape(x)[1:], tf.int32),
                      ],
                      axis=0,
                  ),
              ),
              sampled,
          )
  
imports: import collections
  import contextlib
  import functools
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import invert
  from tensorflow_probability.python.distributions import distribution
  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 normal
  from tensorflow_probability.python.distributions import transformed_distribution
  from tensorflow_probability.python.experimental.mcmc.particle_filter import infer_trajectories
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensorshape_util
label_desc: Use image node_id 9 for calling the DeterministicEmpirical obj's underlying member method code with example usage: obj.sample(sample_shape, seed, name) and returns: tf