def get_img_shape(img):
if isinstance(img, np.ndarray):<EOL><INDENT>shape = img.shape<EOL><DEDENT>else:<EOL><INDENT>shape = K.int_shape(img)<EOL><DEDENT>if K.image_data_format() == '<STR_LIT>':<EOL><INDENT>shape = list(shape)<EOL>shape.insert(<NUM_LIT:1>, shape[-<NUM_LIT:1>])<EOL>shape = tuple(shape[:-<NUM_LIT:1>])<EOL><DEDENT>return shape<EOL>
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.