def _transformer_body(input_embeddings,
                      source_len,
                      target_decode_steps,
                      mode,
                      model_config,
                      output_vocab_size,
                      output_vocab_embeddings_table,
                      input_copy_mask=None):
  """Build a Transformer.

  Args:
    input_embeddings: The embeddings of the input to the Transformer.
    source_len: The length of the input utterance.
    target_decode_steps: Number of steps to generate.
    mode: Mode of the model.
    model_config: Model configuration.
    output_vocab_size: Size of the output vocabulary.
    output_vocab_embeddings_table: Table containing embeddings of output tokens.
    input_copy_mask: Mask on the input utterance for which tokens can be copied.

  Returns:
    Outputs of the transformer.
  """
  # Just apply a simple linear layer here
  encoder_output = common_layers.linear_transform(
      input_embeddings,
      output_size=model_config.model_parameters.encoder_dims,
      scope="bert_to_transformer")

  target_embeddings = _get_target_embeddings(input_embeddings,
                                             output_vocab_embeddings_table,
                                             target_decode_steps, model_config)
  decoder_output = _build_transformer_decoder(encoder_output, source_len,
                                              target_embeddings, mode,
                                              model_config)
  logits = _get_action_logits(
      encoder_output,
      decoder_output,
      output_vocab_embeddings_table,
      output_vocab_size,
      model_config,
      input_copy_mask=input_copy_mask)
  return logits
Build a Transformer.

  Args:
    input_embeddings: The embeddings of the input to the Transformer.
    source_len: The length of the input utterance.
    target_decode_steps: Number of steps to generate.
    mode: Mode of the model.
    model_config: Model configuration.
    output_vocab_size: Size of the output vocabulary.
    output_vocab_embeddings_table: Table containing embeddings of output tokens.
    input_copy_mask: Mask on the input utterance for which tokens can be copied.

  Returns:
    Outputs of the transformer.
  
language/xsp/model/transformer.py