code: def transformer_text_encoder(inputs,
                               target_space,
                               hparams,
                               name=None):
    
    with tf.variable_scope(name, default_name="transformer_text_encoder"):
      inputs = common_layers.flatten4d3d(inputs)
      [
          encoder_input,
          encoder_self_attention_bias,
          ed,
      ] = transformer_layers.transformer_prepare_encoder(
          inputs, target_space=target_space, hparams=hparams)
      encoder_input = tf.nn.dropout(encoder_input, 1.0 - hparams.dropout)
      encoder_output = transformer_layers.transformer_encoder(
          encoder_input, encoder_self_attention_bias, hparams)
      return encoder_output, ed
docs: Transformer text encoder over inputs with unmasked full attention.
  
    Args:
      inputs: Tensor of shape [batch, length, 1, hparams.hidden_size].
      target_space: int. Used for encoding inputs under a target space id.
      hparams: HParams.
      name: string, variable scope.
  
    Returns:
      encoder_output: Tensor of shape [batch, length, hparams.hidden_size].
      ed: Tensor of shape [batch, 1, 1, length]. Encoder-decoder attention bias
        for any padded tokens.