code: def xception_exit(inputs):
      """Xception exit flow."""
      with tf.variable_scope("xception_exit"):
          x = inputs
          x_shape = x.get_shape().as_list()
          if x_shape[1] is None or x_shape[2] is None:
              length_float = tf.to_float(tf.shape(x)[1])
              length_float *= tf.to_float(tf.shape(x)[2])
              spatial_dim_float = tf.sqrt(length_float)
              spatial_dim = tf.to_int32(spatial_dim_float)
              x_depth = x_shape[3]
              x = tf.reshape(x, [-1, spatial_dim, spatial_dim, x_depth])
          elif x_shape[1] != x_shape[2]:
              spatial_dim = int(
                  math.sqrt(float(x_shape[1] * x_shape[2]))
              )
              if spatial_dim * spatial_dim != x_shape[1] * x_shape[2]:
                  raise ValueError(
                      "Assumed inputs were square-able but they were "
                      "not. Shape: %s" % x_shape
                  )
              x = tf.reshape(x, [-1, spatial_dim, spatial_dim, x_depth])
  
          x = common_layers.conv_block_downsample(
              x, (3, 3), (2, 2), "SAME"
          )
          return tf.nn.relu(x)
  
file_path: tensor2tensor/tensor2tensor/models/xception.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  from six.moves import range
  from tensor2tensor.layers import common_hparams
  from tensor2tensor.layers import common_layers
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import t2t_model
  import tensorflow.compat.v1
label_desc: Use image node_id 4 for calling a global function with example usage: xception_exit(inputs) and returns: tf