class_docstr: Top-k sequence generator based on the decoder followed by log_softmax.
  
  Args:
      *all args of GreedySequenceGenerator class
      beam_size: size of the beam (parameter k in top-k)
      temperature: temperature of top-k sampling, all logits are divided
          by temperature before rescaling. High temperature leads to
          uniform distribution, low leads to delta-like distribution.
  Kwargs:
      all remaining parameters of GreedySequenceGenerator class
class_docstr_tok: ["Top-k","sequence","generator","based","on","the","decoder","followed","by","log_softmax",".","Args",":","*","all","args","of","GreedySequenceGenerator","class","beam_size",":","size","of","the","beam","(","parameter","k","in","top-k",")","temperature",":","temperature","of","top-k","sampling",",","all","logits","are","divided","by","temperature","before","rescaling",".","High","temperature","leads","to","uniform","distribution",",","low","leads","to","delta-like","distribution",".","Kwargs",":","all","remaining","parameters","of","GreedySequenceGenerator","class"]
code: def __init__(
      self,
      embedding,
      decoder,
      log_softmax,
      beam_size=1,
      temperature=1.0,
      **kwargs,
  ):
      super().__init__(embedding, decoder, log_softmax, **kwargs)
      self.beam_size = beam_size
      self.temp = temperature
  
imports: from contextlib import contextmanager
  import torch
  from nemo.collections.common.parts import NEG_INF, mask_padded_tokens
label_desc: Use image node_id 1 to create a new TopKSequenceGenerator object from inherited base classes: GreedySequenceGenerator with example: obj = TopKSequenceGenerator(embedding, decoder, log_softmax, beam_size, temperature)