code: def _transpose_spatial_outputs(outputs):
      # Undo the tranpose in `_transpose_spatial_inputs`.
      num_spatial_dims = len(outputs.shape) - 2
      if num_spatial_dims == 1:
          outputs = tf.transpose(outputs, (0, 2, 1))
      elif num_spatial_dims == 2:
          outputs = tf.transpose(outputs, (0, 3, 1, 2))
      elif num_spatial_dims == 3:
          outputs = tf.transpose(outputs, (0, 4, 1, 2, 3))
      return outputs
  
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 18 for calling a global function with example usage: _transpose_spatial_outputs(outputs) and returns: outputs