def random_zoom(x, zoom_range, row_axis=1, col_axis=2, channel_axis=0, fill_mode='nearest', cval=0.0):
    "Performs a random spatial zoom of a Numpy image tensor.\n\n    # Arguments\n        x: Input tensor. Must be 3D.\n        zoom_range: Tuple of floats; zoom range for width and height.\n        row_axis: Index of axis for rows in the input tensor.\n        col_axis: Index of axis for columns in the input tensor.\n        channel_axis: Index of axis for channels in the input tensor.\n        fill_mode: Points outside the boundaries of the input\n            are filled according to the given mode\n            (one of `{'constant', 'nearest', 'reflect', 'wrap'}`).\n        cval: Value used for points outside the boundaries\n            of the input if `mode='constant'`.\n\n    # Returns\n        Zoomed Numpy image tensor.\n\n    # Raises\n        ValueError: if `zoom_range` isn't a tuple.\n    "
    if (len(zoom_range) != 2):
        raise ValueError('`zoom_range` should be a tuple or list of two floats. Received: ', zoom_range)
    if ((zoom_range[0] == 1) and (zoom_range[1] == 1)):
        (zx, zy) = (1, 1)
    else:
        (zx, zy) = np.random.uniform(zoom_range[0], zoom_range[1], 2)
    zoom_matrix = np.array([[zx, 0, 0], [0, zy, 0], [0, 0, 1]])
    (h, w) = (x.shape[row_axis], x.shape[col_axis])
    transform_matrix = transform_matrix_offset_center(zoom_matrix, h, w)
    x = apply_transform(x, transform_matrix, channel_axis, fill_mode, cval)
    return x
Performs a random spatial zoom of a Numpy image tensor.

# Arguments
    x: Input tensor. Must be 3D.
    zoom_range: Tuple of floats; zoom range for width and height.
    row_axis: Index of axis for rows in the input tensor.
    col_axis: Index of axis for columns in the input tensor.
    channel_axis: Index of axis for channels in the input tensor.
    fill_mode: Points outside the boundaries of the input
        are filled according to the given mode
        (one of `{'constant', 'nearest', 'reflect', 'wrap'}`).
    cval: Value used for points outside the boundaries
        of the input if `mode='constant'`.

# Returns
    Zoomed Numpy image tensor.

# Raises
    ValueError: if `zoom_range` isn't a tuple.
def random_zoom(x, zoom_range, row_axis=1, col_axis=2, channel_axis=0, fill_mode='nearest', cval=0.0):
    "Performs a random spatial zoom of a Numpy image tensor.\n\n    # Arguments\n        x: Input tensor. Must be 3D.\n        zoom_range: Tuple of floats; zoom range for width and height.\n        row_axis: Index of axis for rows in the input tensor.\n        col_axis: Index of axis for columns in the input tensor.\n        channel_axis: Index of axis for channels in the input tensor.\n        fill_mode: Points outside the boundaries of the input\n            are filled according to the given mode\n            (one of `{'constant', 'nearest', 'reflect', 'wrap'}`).\n        cval: Value used for points outside the boundaries\n            of the input if `mode='constant'`.\n\n    # Returns\n        Zoomed Numpy image tensor.\n\n    # Raises\n        ValueError: if `zoom_range` isn't a tuple.\n    "
    if (len(zoom_range) != 2):
        raise ValueError('`zoom_range` should be a tuple or list of two floats. Received: ', zoom_range)
    if ((zoom_range[0] == 1) and (zoom_range[1] == 1)):
        (zx, zy) = (1, 1)
    else:
        (zx, zy) = np.random.uniform(zoom_range[0], zoom_range[1], 2)
    zoom_matrix = np.array([[zx, 0, 0], [0, zy, 0], [0, 0, 1]])
    (h, w) = (x.shape[row_axis], x.shape[col_axis])
    transform_matrix = transform_matrix_offset_center(zoom_matrix, h, w)
    x = apply_transform(x, transform_matrix, channel_axis, fill_mode, cval)
    return x