code: def _mix_tokens(p_sample, gold_targets, sampled_targets):
      """Interleave sampled and gold tokens randomly.
  
      Args:
        p_sample: float in [0, 1]. Probability a token will come from
          'sampled_targets'. 0 means all-gold, 1 means all-sampled.
        gold_targets: Tensor. Gold token IDs.
        sampled_targets: Tensor. Sampled token IDs. Same shape as 'gold_targets'.
  
      Returns:
        Tensor of same shape as 'gold_targets' containing a mix of tokens from
        'gold_targets' and 'sampled_targets'.
      """
      targets_shape = common_layers.shape_list(sampled_targets)
      return tf.where(
          tf.less(tf.random_uniform(targets_shape), p_sample),
          sampled_targets,
          gold_targets,
      )
  
file_path: tensor2tensor/tensor2tensor/utils/scheduled_sampling.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  from tensor2tensor.layers import common_layers
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
  from tensorflow.python.ops import inplace_ops
label_desc: Use image node_id 3 for calling a global function with example usage: _mix_tokens(p_sample, gold_targets, sampled_targets) and returns: tf