def _transform(self, x: "tf.Tensor", y: "tf.Tensor" | None, **kwargs) -> tuple["tf.Tensor", "tf.Tensor" | None]:
        """
        Transformation of an input image and its label by randomly sampled rotation.

        :param x: Input samples.
        :param y: Label of the samples `x`.
        :return: Transformed samples and labels.
        """
        import tensorflow as tf
        import tensorflow_addons as tfa

        angles = tf.random.uniform(shape=(), minval=self.angles_range[0], maxval=self.angles_range[1])
        angles = angles / 360.0 * 2.0 * np.pi
        x_preprocess = tfa.image.rotate(images=x, angles=angles, interpolation="NEAREST", name=None)
        x_preprocess = tf.clip_by_value(
            t=x_preprocess, clip_value_min=-self.clip_values[0], clip_value_max=self.clip_values[1], name=None
        )
        return x_preprocess, y

        Transformation of an input image and its label by randomly sampled rotation.

        :param x: Input samples.
        :param y: Label of the samples `x`.
        :return: Transformed samples and labels.
        
art/preprocessing/expectation_over_transformation/image_rotation/tensorflow.py