def SingleDecodeStep(self,
                       theta,
                       packed_src,
                       cur_target_info,
                       decoder_step_state,
                       per_step_src_padding=None,
                       use_deterministic_random=False):
    """Computes one 'step' of computation for the decoder.

    Must be implemented by sub-classes. Residual connections must also be taken
    care of in sub-classes.

    Args:
      theta: A NestedMap object containing weights' values of this
        layer and its children layers.
      packed_src: A NestedMap to represent the packed source tensors generated
        by the attention model.
      cur_target_info: TargetInfo namedtuple, which represents the targets
        which represents information about the target at this step. It is up
        to the various sub-classes to determine how to process the current
        target.
      decoder_step_state: DecoderStepState which encapsulates the state of the
        decoder before computing outputs at the current step.
      per_step_src_padding: Optional padding to be applied to the source_encs
        which overrides the default padding in source_paddings. Used, for
        example, by the Neural Transducer (NT) decoder.
      use_deterministic_random: whether to use deterministic random numbers when
        needed. Must be set to True if called from functional recurrent.

    Returns:
      A tuple (step_out, new_decoder_state) which represent the outputs of the
      decoder (usually logits), and the new decoder state after processing the
      current step.
    """
    # TODO(syzhang): unify the API to always pass in packed_src.
    raise NotImplementedError('Must be implemented by sub-classes.')
Computes one 'step' of computation for the decoder.

    Must be implemented by sub-classes. Residual connections must also be taken
    care of in sub-classes.

    Args:
      theta: A NestedMap object containing weights' values of this
        layer and its children layers.
      packed_src: A NestedMap to represent the packed source tensors generated
        by the attention model.
      cur_target_info: TargetInfo namedtuple, which represents the targets
        which represents information about the target at this step. It is up
        to the various sub-classes to determine how to process the current
        target.
      decoder_step_state: DecoderStepState which encapsulates the state of the
        decoder before computing outputs at the current step.
      per_step_src_padding: Optional padding to be applied to the source_encs
        which overrides the default padding in source_paddings. Used, for
        example, by the Neural Transducer (NT) decoder.
      use_deterministic_random: whether to use deterministic random numbers when
        needed. Must be set to True if called from functional recurrent.

    Returns:
      A tuple (step_out, new_decoder_state) which represent the outputs of the
      decoder (usually logits), and the new decoder state after processing the
      current step.
    
contrib/lingvo-patched-decoder.py