code: def standard(temperature: float = 1.0) -> Sampler:
      def sample(logits: Logits) -> Sample:
          logits = logits / (temperature + 1e-7)
  
          # There was a regression in torch that made categorical only work with fp32.
          # We can track the issue on github and remove this once it makes it into a
          # pytorch release or nightly:
          #
          # https://github.com/pytorch/pytorch/issues/29211
          #
          logits_fp32 = logits.float()
  
          return Sample(
              logits=logits,
              tokens=torch.distributions.Categorical(
                  logits=logits_fp32
              ).sample(),
          )
  
      return sample
  
imports: from dataclasses import dataclass
  from typing import Callable
  import torch
label_desc: Use image node_id 1 for calling a global function with example usage: standard(temperature) and returns: sample, Sample