class_docstr: SwitchOut.
  :cite:`DBLP:journals/corr/abs-1808-07512`
code: def _switchout(self, tokens, vocab, stats=None):
      # 1. sample number of tokens to corrupt
      n_chosen = self._sample_distance(tokens, self.temperature)
      # 2. sample positions to corrput
      chosen_indices = self._sample_position(tokens, distance=n_chosen)
      # 3. sample corrupted values
      for i in chosen_indices:
          tokens[i] = self._sample_replace(vocab, reject=tokens[i])
      if stats is not None:
          stats.update(SwitchOutStats(n_chosen, len(tokens)))
      return tokens
  
imports: import random
  import numpy
  from onmt.constants import DefaultTokens
  from onmt.transforms import register_transform
  from .transform import Transform, ObservableStats
label_desc: Use image node_id 5 for calling the SwitchOutTransform obj's underlying member method code with example usage: obj._switchout(tokens, vocab, stats) and returns: tokens