class_docstr: ## Sampler with Temperature
class_docstr_tok: ["#","#","Sampler","with","Temperature"]
docstr: Sample from logits
docstr_tok: ["Sample","from","logits"]
code: def __call__(self, logits: torch.Tensor):
      """
      Sample from logits
      """
  
      # Create a categorical distribution with temperature adjusted logits
      dist = Categorical(logits=logits / self.temperature)
  
      # Sample
      return dist.sample()
  
imports: import torch
  from torch.distributions import Categorical
  from labml_nn.sampling import Sampler
label_desc: Use image node_id 2 for calling the TemperatureSampler obj's underlying member method code with example usage: obj.__call__(logits) and returns: dist