def forward(
        self,
        x: "tf.Tensor",
        y: "tf.Tensor" | list[dict[str, "tf.Tensor"]] | None = None,
    ) -> tuple["tf.Tensor", "tf.Tensor" | list[dict[str, "tf.Tensor"]] | None]:
        """
        Resize `x` and adjust bounding boxes for labels `y` accordingly.

        :param x: Input samples. A list of samples is also supported.
        :param y: Label of the samples `x`.
        :return: Transformed samples and labels.
        """
        import tensorflow as tf

        x_preprocess_list = []
        y_preprocess: tf.Tensor | list[dict[str, tf.Tensor]] | None
        if y is not None and self.label_type == "object_detection":
            y_preprocess = []
        else:
            y_preprocess = y

        for i, x_i in enumerate(tqdm(x, desc="ImageResizeTensorFlowV2", disable=not self.verbose)):
            if self.channels_first:
                x_i = tf.transpose(x_i, (1, 2, 0))

            # OpenCV swaps height and width
            x_resized = tf.image.resize(x_i, size=(self.height, self.width), method=self.interpolation)

            if self.channels_first:
                x_resized = tf.transpose(x_resized, (2, 0, 1))

            x_preprocess_list.append(x_resized)

            if self.label_type == "object_detection" and y is not None:
                y_resized: dict[str, tf.Tensor] = {}

                # Copy labels and ensure types
                if isinstance(y, list) and isinstance(y_preprocess, list):
                    y_i = y[i]
                    if isinstance(y_i, dict):
                        y_resized = {k: tf.identity(v) for k, v in y_i.items()}
                    else:
                        raise TypeError("Wrong type for `y` and label_type=object_detection.")
                else:
                    raise TypeError("Wrong type for `y` and label_type=object_detection.")

                # Calculate scaling factor
                height, width, _ = x_i.shape
                height_scale = self.height / height
                width_scale = self.width / width

                # Resize bounding boxes
                boxes = y_resized["boxes"]
                boxes *= tf.constant([width_scale, height_scale, width_scale, height_scale], dtype=boxes.dtype)
                y_resized["boxes"] = boxes

                y_preprocess.append(y_resized)

        x_preprocess = tf.stack(x_preprocess_list)
        if self.clip_values is not None:
            x_preprocess = tf.clip_by_value(x_preprocess, self.clip_values[0], self.clip_values[1])

        return x_preprocess, y_preprocess

        Resize `x` and adjust bounding boxes for labels `y` accordingly.

        :param x: Input samples. A list of samples is also supported.
        :param y: Label of the samples `x`.
        :return: Transformed samples and labels.
        
art/preprocessing/image/image_resize/tensorflow.py