code: def final_block(x1, x2, dim="2d", training=True, scope="final_block"):
      """Converts activations from last RevNet block to pre-logits.
  
      Args:
        x1: [NxHxWxC] tensor of network activations.
        x2: [NxHxWxC] tensor of network activations.
        dim: '2d' if 2-dimensional, '3d' if 3-dimensional.
        training: True for train phase, False for eval phase.
        scope: Optional variable scope for the final block.
  
      Returns:
        [N, hidden_dim] pre-logits tensor from activations x1 and x2.
      """
  
      # Final batch norm and relu
      with tf.variable_scope(scope):
          y = tf.concat([x1, x2], axis=CONFIG[dim]["split_axis"])
          y = tf.layers.batch_normalization(y, training=training)
          y = tf.nn.relu(y)
  
          # Global average pooling
          net = tf.reduce_mean(
              y,
              CONFIG[dim]["reduction_dimensions"],
              name="final_pool",
              keep_dims=True,
          )
  
          return net
  
imports: import functools
  from tensor2tensor.layers import common_hparams
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import t2t_model
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 7 for calling a global function with example usage: final_block(x1, x2, dim, training, scope) and returns: net