def METHOD_NAME(self, size, data_format):
    # batched case
    if data_format == "channels_first":
        img = np.random.random((2, 3, 9, 11))
    else:
        img = np.random.random((2, 9, 11, 3))
    out = layers.CenterCrop(
        size[0],
        size[1],
        data_format=data_format,
    )(img)
    if data_format == "channels_first":
        img_transpose = np.transpose(img, (0, 2, 3, 1))
        ref_out = np.transpose(
            self.np_center_crop(img_transpose, size[0], size[1]),
            (0, 3, 1, 2),
        )
    else:
        ref_out = self.np_center_crop(img, size[0], size[1])
    self.assertAllClose(ref_out, out)
    # unbatched case
    if data_format == "channels_first":
        img = np.random.random((3, 9, 11))
    else:
        img = np.random.random((9, 11, 3))
    out = layers.CenterCrop(
        size[0],
        size[1],
        data_format=data_format,
    )(img)
    if data_format == "channels_first":
        img_transpose = np.transpose(img, (1, 2, 0))
        ref_out = np.transpose(
            self.np_center_crop(
                img_transpose,
                size[0],
                size[1],
            ),
            (2, 0, 1),
        )
    else:
        ref_out = self.np_center_crop(
            img,
            size[0],
            size[1],
        )
    self.assertAllClose(ref_out, out)