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

Before Change


        for i, s in enumerate(self._all_states):
            param_groups.extend(s["param_groups"])
            end = start + len(s["param_groups"])
            partition.append((start, end))
            start = end

        return {

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: 3

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: pytorch/tutorials
Commit Name: a0955ef193c65f565de17e18140c033e528c36b3
Time: 2017-09-16
Author: sasankchilamkurthy@gmail.com
File Name: beginner_source/transfer_learning_tutorial.py
Class Name:
Method Name: train_model


Project Name: facebookresearch/ParlAI
Commit Name: 49c673dd5a25462651f2f9f8a516c5c43e4b8d9f
Time: 2017-08-29
Author: belbs@users.noreply.github.com
File Name: parlai/agents/memnn/memnn.py
Class Name: MemnnAgent
Method Name: save