code: def get_img_shape(img):
      
      if isinstance(img, np.ndarray):
          shape = img.shape
      else:
          shape = K.int_shape(img)
  
      if K.image_data_format() == 'channels_last':
          shape = list(shape)
          shape.insert(1, shape[-1])
          shape = tuple(shape[:-1])
      return shape
docs: Returns image shape in a backend agnostic manner.
  
      Args:
          img: An image tensor of shape: `(channels, image_dims...)` if data_format='channels_first' or
              `(image_dims..., channels)` if data_format='channels_last'.
  
      Returns:
          Tuple containing image shape information in `(samples, channels, image_dims...)` order.