code: def encoder(name, hparams, inputs, target_space):
      """Compute encoder outputs and attention bias."""
      with tf.variable_scope(name, reuse=tf.AUTO_REUSE):
          (
              encoder_input,
              encoder_self_attention_bias,
              encoder_decoder_attention_bias,
          ) = transformer_prepare_encoder(inputs, target_space, hparams)
          encoder_input = tf.nn.dropout(
              encoder_input, rate=hparams.layer_prepostprocess_dropout
          )
          encoder_output = transformer_encoder(
              encoder_input, encoder_self_attention_bias, hparams
          )
          return encoder_output, encoder_decoder_attention_bias
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from six.moves import range
  from tensor2tensor.layers import common_attention
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers import transformer_glow_layers_ops
  from tensor2tensor.models.transformer import transformer_decoder_layer
  from tensor2tensor.models.transformer import transformer_encoder
  from tensor2tensor.models.transformer import transformer_prepare_encoder
  from tensor2tensor.utils import learning_rate
  from tensor2tensor.utils import mlperf_log
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 2 for calling a global function with example usage: encoder(name, hparams, inputs, target_space) and returns: encoder_output,  encoder_decoder_attention_bias