9942689f9846c59006c80718ee8db38e02ee2104,albumentations/core/transforms_interface.py,BasicTransform,__call__,#BasicTransform#Any#,52

Before Change


    def __call__(self, force_apply=False, **kwargs):
        if (random.random() < self.p) or self.always_apply or force_apply:
            params = self.get_params()
            params = self.update_params(params, **kwargs)
            if self.targets_as_params:
                assert all(key in kwargs for key in self.targets_as_params), "{} requires {}".format(
                    self.__class__.__name__, self.targets_as_params
                )
                targets_as_params = {k: kwargs[k] for k in self.targets_as_params}
                params_dependent_on_targets = self.get_params_dependent_on_targets(targets_as_params)
                params.update(params_dependent_on_targets)
            res = {}
            for key, arg in kwargs.items():
                if arg is not None:
                    target_function = self._get_target_function(key)
                    target_dependencies = {k: kwargs[k] for k in self.target_dependence.get(key, [])}
                    res[key] = target_function(arg, **dict(params, **target_dependencies))
                else:
                    res[key] = None
            return res

After Change


                        self.get_class_fullname() + " could work incorrectly in ReplayMode for other input data"
                        " because its" params depend on targets."
                    )
                kwargs[self.save_key][id(self)] = deepcopy(params)
            return self.apply_with_params(params, **kwargs)

        return kwargs
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 5

Instances


Project Name: albu/albumentations
Commit Name: 9942689f9846c59006c80718ee8db38e02ee2104
Time: 2019-09-27
Author: al.buslaev@gmail.com
File Name: albumentations/core/transforms_interface.py
Class Name: BasicTransform
Method Name: __call__


Project Name: NeuromorphicProcessorProject/snn_toolbox
Commit Name: 858e82aade1b6439b9284e8baa836a23003583c1
Time: 2016-11-23
Author: bodo.rueckauer@gmail.com
File Name: snntoolbox/model_libs/keras_input_lib.py
Class Name:
Method Name: extract


Project Name: has2k1/plotnine
Commit Name: 5464fc26226597d26b4705b6cbce3dd092b9706c
Time: 2015-10-12
Author: has2k1@gmail.com
File Name: ggplot/themes/theme_xkcd.py
Class Name: theme_xkcd
Method Name: __deepcopy__


Project Name: pytorch/pytorch
Commit Name: 249c21346208b682d128e28fe4480262f8b76cd8
Time: 2021-02-27
Author: benjamin.lefaudeux@gmail.com
File Name: torch/distributed/optim/zero_redundancy_optimizer.py
Class Name: ZeroRedundancyOptimizer
Method Name: state_dict