class_docstr: Mixed greedy and probabilistic sampling. Compute both and pick the right one for each sample.
class_docstr_tok: ["Mixed","greedy","and","probabilistic","sampling",".","Compute","both","and","pick","the","right","one","for","each","sample","."]
code: def __call__(self, logits):
      out = torch.empty(
          logits.shape[0], dtype=torch.int64, device=logits.device
      )
      if self.greedy_indices:
          # Computing for all indices is faster than slicing
          torch.argmax(logits, -1, out=out)
  
      for i, sampling in self.sampling_mapping.items():
          out[i] = sampling(logits[i])
      return out
  
imports: import re
  from typing import Callable, List, Optional, Tuple
  import torch
  from text_generation_server.pb import generate_pb2
  from text_generation_server.pb.generate_pb2 import FinishReason
  from text_generation_server.utils.logits_process import HeterogeneousProcessorWrapper, HeterogeneousRepetitionPenaltyLogitsProcessor, HeterogeneousTemperatureLogitsWarper, HeterogeneousTopKLogitsWarper, HeterogeneousTopPLogitsWarper, HeterogeneousTypicalLogitsWarper, static_warper
  from text_generation_server.utils.watermark import WatermarkLogitsProcessor
  from transformers import PreTrainedTokenizerBase, RepetitionPenaltyLogitsProcessor
label_desc: Use image node_id 2 for calling the HeterogeneousSampling obj's underlying member method code with example usage: obj.__call__(logits) and returns: out