def five_crop(img, size):
if isinstance(size, numbers.Number):<EOL><INDENT>size = (int(size), int(size))<EOL><DEDENT>else:<EOL><INDENT>assert len(size) == <NUM_LIT:2>, "<STR_LIT>"<EOL><DEDENT>w, h = img.size<EOL>crop_h, crop_w = size<EOL>if crop_w > w or crop_h > h:<EOL><INDENT>raise ValueError("<STR_LIT>".format(size,<EOL>(h, w)))<EOL><DEDENT>tl = img.crop((<NUM_LIT:0>, <NUM_LIT:0>, crop_w, crop_h))<EOL>tr = img.crop((w - crop_w, <NUM_LIT:0>, w, crop_h))<EOL>bl = img.crop((<NUM_LIT:0>, h - crop_h, crop_w, h))<EOL>br = img.crop((w - crop_w, h - crop_h, w, h))<EOL>center = center_crop(img, (crop_h, crop_w))<EOL>return (tl, tr, bl, br, center)<EOL>
Crop the given PIL Image into four corners and the central crop.

    .. Note::
        This transform returns a tuple of images and there may be a
        mismatch in the number of inputs and targets your ``Dataset`` returns.

    Args:
       size (sequence or int): Desired output size of the crop. If size is an
           int instead of sequence like (h, w), a square crop (size, size) is
           made.

    Returns:
       tuple: tuple (tl, tr, bl, br, center)
                Corresponding top left, top right, bottom left, bottom right and center crop.