def _transform(
        self, x: "torch.Tensor", y: "torch.Tensor" | list[dict[str, "torch.Tensor"]] | None, **kwargs
    ) -> tuple["torch.Tensor", "torch.Tensor" | list[dict[str, "torch.Tensor"]] | None]:
        """
        Transformation of an image with randomly sampled brightness.

        :param x: Input samples.
        :param y: Label of the samples `x`.
        :return: Transformed samples and labels.
        """
        import torch

        delta_i = np.random.uniform(low=self.delta_range[0], high=self.delta_range[1])
        return torch.clamp(x + delta_i, min=self.clip_values[0], max=self.clip_values[1]), y

        Transformation of an image with randomly sampled brightness.

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