code: def _transpose_spatial_inputs(inputs):
      num_spatial_dims = len(inputs.shape) - 2
      # Tensorflow pooling does not support `channels_first` format, so
      # we need to transpose to `channels_last` format.
      if num_spatial_dims == 1:
          inputs = tf.transpose(inputs, (0, 2, 1))
      elif num_spatial_dims == 2:
          inputs = tf.transpose(inputs, (0, 2, 3, 1))
      elif num_spatial_dims == 3:
          inputs = tf.transpose(inputs, (0, 2, 3, 4, 1))
      else:
          raise ValueError(
              "Pooling inputs's shape must be 3, 4 or 5, corresponding to 1D, 2D "
              f"and 3D inputs. But received shape: {inputs.shape}."
          )
      return inputs
  
imports: import warnings
  import tensorflow
  from keras.backend import standardize_data_format
  from keras.backend import standardize_dtype
  from keras.backend.common.backend_utils import compute_conv_transpose_output_shape
  from keras.backend.config import epsilon
  from keras.backend.tensorflow.core import cast
  from keras.backend.tensorflow.core import convert_to_tensor
label_desc: Use image node_id 17 for calling a global function with example usage: _transpose_spatial_inputs(inputs) and returns: inputs