116e41cc7a8748c6b1b781846d14b4ca5ff32fd7,art/defences/preprocessor/jpeg_compression.py,JpegCompression,set_params,#JpegCompression#,167

Before Change


        super(JpegCompression, self).set_params(**kwargs)

        if not isinstance(self.quality, (int, np.int)) or self.quality <= 0 or self.quality > 100:
            logger.error("Image quality must be a positive integer <= 100.")
            raise ValueError("Image quality must be a positive integer <= 100.")

        if not isinstance(self.channel_index, (int, np.int)) or self.channel_index <= 0:
            logger.error("Data channel must be a positive integer. The batch dimension is not a valid channel.")
            raise ValueError("Data channel must be a positive integer. The batch dimension is not a valid channel.")

        if len(self.clip_values) != 2:
            raise ValueError("`clip_values` should be a tuple of 2 floats or arrays containing the allowed data range.")

After Change


        if not isinstance(self.quality, (int, np.int)) or self.quality <= 0 or self.quality > 100:
            raise ValueError("Image quality must be a positive integer <= 100.")

        if not (isinstance(self.channel_index, (int, np.int)) and self.channel_index in [1, 3]):
            raise ValueError(
                "Data channel must be an integer equal to 1 or 2. The batch dimension is not a valid channel."
            )

        if len(self.clip_values) != 2:
            raise ValueError(""clip_values" should be a tuple of 2 floats or arrays containing the allowed data range.")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 18

Instances


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 116e41cc7a8748c6b1b781846d14b4ca5ff32fd7
Time: 2020-05-14
Author: hesseltuinhof@users.noreply.github.com
File Name: art/defences/preprocessor/jpeg_compression.py
Class Name: JpegCompression
Method Name: set_params


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 116e41cc7a8748c6b1b781846d14b4ca5ff32fd7
Time: 2020-05-14
Author: hesseltuinhof@users.noreply.github.com
File Name: art/defences/preprocessor/jpeg_compression.py
Class Name: JpegCompression
Method Name: set_params


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 9a626bc8a3518c1ceef449ef5fe643811d287557
Time: 2020-05-20
Author: ebube.chuba@ibm.com
File Name: art/defences/preprocessor/jpeg_compression.py
Class Name: JpegCompression
Method Name: set_params


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 1d4d8b5896cd413add8d37217d46bd63ff1b2d22
Time: 2020-05-20
Author: hesseltuinhof@users.noreply.github.com
File Name: art/defences/preprocessor/jpeg_compression.py
Class Name: JpegCompression
Method Name: set_params


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 5bdbc96a3dbc0675a66c56c033dfc2cb44f828f9
Time: 2020-05-22
Author: hesseltuinhof@users.noreply.github.com
File Name: art/defences/preprocessor/spatial_smoothing.py
Class Name: SpatialSmoothing
Method Name: set_params