def _resize_images(
        self,
        x,
        height_factor,
        width_factor,
        data_format,
        interpolation="nearest",
    ):
        """Resizes the images contained in a 4D tensor.

        Args:
            x: Tensor or variable to resize.
            height_factor: Positive integer.
            width_factor: Positive integer.
            data_format: One of `"channels_first"`, `"channels_last"`.
            interpolation: A string, one of `"bicubic"`, `"bilinear"`,
            `"lanczos3"`, `"lanczos5"`, or `"nearest"`.

        Returns:
            A tensor.
        """
        if data_format not in {"channels_last", "channels_first"}:
            raise ValueError(f"Invalid `data_format` argument: {data_format}")

        if data_format == "channels_first":
            x = ops.transpose(x, [0, 2, 3, 1])
        # https://github.com/keras-team/keras/issues/294
        # Use `ops.repeat` for `nearest` interpolation to enable XLA
        if interpolation == "nearest":
            x = ops.repeat(x, height_factor, axis=1)
            x = ops.repeat(x, width_factor, axis=2)
        else:
            # multiply the height and width factor on each dim
            # by hand (versus using element-wise multiplication
            # by np.array([height_factor, width_factor]) then
            # list-ifying the tensor by calling `.tolist()`)
            # since when running under torchdynamo, `new_shape`
            # will be traced as a symbolic variable (specifically
            # a `FakeTensor`) which does not have a `tolist()` method.
            shape = ops.shape(x)
            new_shape = (
                shape[1] * height_factor,
                shape[2] * width_factor,
            )
            x = ops.image.resize(x, new_shape, interpolation=interpolation)
        if data_format == "channels_first":
            x = ops.transpose(x, [0, 3, 1, 2])

        return x
Resizes the images contained in a 4D tensor.

        Args:
            x: Tensor or variable to resize.
            height_factor: Positive integer.
            width_factor: Positive integer.
            data_format: One of `"channels_first"`, `"channels_last"`.
            interpolation: A string, one of `"bicubic"`, `"bilinear"`,
            `"lanczos3"`, `"lanczos5"`, or `"nearest"`.

        Returns:
            A tensor.
        
keras/src/layers/reshaping/up_sampling2d.py