class_docstr: SwitchOut.
  :cite:`DBLP:journals/corr/abs-1808-07512`
docstr: Apply switchout to both src and tgt side tokens.
docstr_tok: ["Apply","switchout","to","both","src","and","tgt","side","tokens","."]
code: def apply(self, example, is_train=False, stats=None, **kwargs):
      """Apply switchout to both src and tgt side tokens."""
      if is_train:
          example["src"] = self._switchout(
              example["src"], self.vocabs["src"].ids_to_tokens, stats
          )
          example["tgt"] = self._switchout(
              example["tgt"], self.vocabs["tgt"].ids_to_tokens, stats
          )
      return example
  
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 6 for calling the SwitchOutTransform obj's underlying member method code with example usage: obj.apply(example, is_train, stats) and returns: example