class_docstr: A helper for use during inference.
  
  Samples from `top_k` most likely candidates from a vocab distribution,
  and passes the result through an embedding layer to get the next input.
class_docstr_tok: ["A","helper","for","use","during","inference",".","Samples","from","`","top_k","`","most","likely","candidates","from","a","vocab","distribution",",","and","passes","the","result","through","an","embedding","layer","to","get","the","next","input","."]
docstr: Gets a sample for one step.
docstr_tok: ["Gets","a","sample","for","one","step","."]
code: def sample(self, time, outputs, state, name=None):
      """Gets a sample for one step."""
      del time, state  # unused by sample_fn
      # Outputs are logits, we sample from the top_k candidates
      if not isinstance(outputs, tf.Tensor):
          raise TypeError(
              "Expected outputs to be a single Tensor, got: %s"
              % type(outputs)
          )
      if self._softmax_temperature is None:
          logits = outputs
      else:
          logits = outputs / self._softmax_temperature
  
      logits = _top_k_logits(logits, k=self._top_k)
  
      sample_id_sampler = tfpd.Categorical(logits=logits)
      sample_ids = sample_id_sampler.sample(seed=self._seed)
  
      return sample_ids
  
imports: import tensorflow
  from tensorflow.python.ops import array_ops
  from tensorflow_probability import distributions
  from texar.tf.modules.decoders.tf_helpers import Helper, TrainingHelper, GreedyEmbeddingHelper
  from texar.tf.modules.embedders.embedder_utils import soft_embedding_lookup
  from texar.tf.utils import utils
label_desc: Use image node_id 2 for calling the TopKSampleEmbeddingHelper obj's underlying member method code with example usage: obj.sample(time, outputs, state, name) and returns: sample_ids