code: def sequential_scheduled_sampling_for_t2tmodel(t2tmodel, features):
      """Schedule Sampling for T2TModels.
  
      Args:
        t2tmodel: T2TModel instance.
        features: {str: Tensor}. Input features.
  
      Returns:
        ss_logits: [batch_size, seq_len, 1, 1, vocab_size].
        losses_dict: {str: scalar Tensor}. Losses to minimize.
      """
      targets = features["targets"]
      targets_size = common_layers.shape_list(targets)
      batch_size = targets_size[0]
      seq_len = targets_size[1]
      targets = tf.reshape(targets, [batch_size, seq_len])
  
      adapter = ScheduledSamplingAdapter(t2tmodel, features)
      ss_tokens, ss_logits, losses_dict = sequential_scheduled_sampling(
          infer_fn=adapter.infer_fn,
          mix_fn=adapter.mix_fn,
          loss_fn=adapter.loss_fn,
          targets=targets,
      )
  
      _ = ss_tokens  # unused.
      targets_vocab_size = t2tmodel.problem_hparams.vocab_size[
          "targets"
      ]
      ss_logits = tf.reshape(
          ss_logits, [batch_size, seq_len, 1, 1, targets_vocab_size]
      )
  
      return ss_logits, losses_dict
  
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 1 for calling a global function with example usage: sequential_scheduled_sampling_for_t2tmodel(t2tmodel, features) and returns: ss_logits,  losses_dict