def _save_image(image, filename, nrow=<NUM_LIT:8>, padding=<NUM_LIT:2>, square_image=True):
if not isinstance(image, NDArray):<EOL><INDENT>raise TypeError('<STR_LIT>'.format(str(type(image))))<EOL><DEDENT>image = _prepare_image(image, nrow=nrow, padding=padding, square_image=square_image)<EOL>if Image is None:<EOL><INDENT>raise ImportError('<STR_LIT>')<EOL><DEDENT>im = Image.fromarray(image.asnumpy())<EOL>im.save(filename)<EOL>
Saves a given Tensor into an image file. If the input tensor contains multiple images,
    a grid of images will be saved.

    Parameters
    ----------
        image : `NDArray`
            Input image(s) in the format of HW, CHW, or NCHW.
        filename : str
            Filename of the saved image(s).
        nrow : int
            Number of images displayed in each row of the grid. The Final grid size is
            (batch_size / `nrow`, `nrow`) when square_image is False; otherwise, (`nrow`, `nrow`).
        padding : int
            Padding value for each image in the grid.
        square_image : bool
            If True, force the image grid to be strictly square.