code: def xception_exit(inputs):
    
    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)
docs: Xception exit flow.