59d4bbaaf06850e2dfb357855f50b05f6c9aadb1,syft/frameworks/torch/fl/utils.py,,scale_model,#Any#Any#,53

Before Change



    
    params = model.named_parameters()
    dict_params = dict(params)
    with torch.no_grad():
        for name, param in dict_params.items():
            dict_params[name].set_(dict_params[name].data * scale)
    return model

After Change


    with torch.no_grad():
        for name in params:
            params[name] = params[name].type_as(scale) * scale
    scaled_model = copy.deepcopy(model)
    scaled_model.load_state_dict(params, strict=False)
    return scaled_model

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 5

Non-data size: 4

Instances


Project Name: OpenMined/PySyft
Commit Name: 59d4bbaaf06850e2dfb357855f50b05f6c9aadb1
Time: 2020-10-02
Author: skywind29@users.noreply.github.com
File Name: syft/frameworks/torch/fl/utils.py
Class Name:
Method Name: scale_model


Project Name: snipsco/snips-nlu
Commit Name: 7c50d9677032e4ea15c5c5ca5c96a85994aa39a4
Time: 2018-02-15
Author: clement.doumouro@gmail.com
File Name: nlu_dataset/assistant_dataset.py
Class Name: AssistantDataset
Method Name: json


Project Name: arogozhnikov/einops
Commit Name: eef962609b8bfaef8454bada53fef75f26b702bd
Time: 2018-10-08
Author: iamfullofspam@gmail.com
File Name: test_layers.py
Class Name:
Method Name: test_transpose


Project Name: has2k1/plotnine
Commit Name: 51696521c68b6a1b9af2e05eee4df944981daf5a
Time: 2014-03-30
Author: has2k1@gmail.com
File Name: ggplot/geoms/geom.py
Class Name: geom
Method Name: plot_layer


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__