249c21346208b682d128e28fe4480262f8b76cd8,torch/distributed/optim/zero_redundancy_optimizer.py,ZeroRedundancyOptimizer,state_dict,#ZeroRedundancyOptimizer#,393

Before Change



        // Flatten the param_groups, save the partition which logs the rank <> shard correspondence
        partition: List[Tuple[int, int]] = []
        param_groups: List[Dict[Any, Any]] = []

        start = 0
        for i, s in enumerate(self._all_states):
            param_groups.extend(s["param_groups"])

After Change


        // Unify the shard states and the state that pytorch would expect, given the model.
        // Indexation needs several redirections, since each shard only knows a limited scope of the model
        // - get the pytorch compliant parameter indexing
        state_dict = super().state_dict()

        // - go through the per-shard states, which are all indexed locally
        for rank, s in enumerate(self._all_states):
            // -- match the local indexing and the global partition, update the corresponding saved state globally
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

Instances


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


Project Name: horovod/horovod
Commit Name: 6889773ea1f550042e37a219c63ee4f4200e983c
Time: 2021-01-25
Author: tgaddair@gmail.com
File Name: test/parallel/test_torch.py
Class Name: TorchTests
Method Name: test_broadcast_state


Project Name: jindongwang/transferlearning
Commit Name: 2733bef356c53286d475a67476d88d4840923830
Time: 2020-09-30
Author: jindongwang@outlook.com
File Name: code/deep/finetune_AlexNet_ResNet/finetune_office31.py
Class Name:
Method Name: finetune


Project Name: facebookresearch/Horizon
Commit Name: 620d2c767c309327aa04210192b08f1c1fd0de76
Time: 2020-04-28
Author: jjg@fb.com
File Name: reagent/test/models/test_bcq.py
Class Name: TestBCQ
Method Name: test_forward_pass