7c3c41e93c1ad3dacbc2cbbaab9942a8d96c37bc,jiant/utils/torch_utils.py,,copy_state_dict,#Any#Any#,41
Before Change
if target_device is None:
return copied_state_dict
else:
return {k: v.to(target_device) for k, v in copied_state_dict.items()}
def get_parent_child_module_list(model):
ls = []
After Change
new_state_dict = {}
unique_dict = {}
for k, v in copied_state_dict.items():
unique_key = tuple(v.shape), v.data_ptr()
if unique_key not in unique_dict:
unique_dict[unique_key] = v.to(target_device)
// Create a view
new_state_dict[k] = unique_dict[unique_key][:]
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances Project Name: jsalt18-sentence-repl/jiant
Commit Name: 7c3c41e93c1ad3dacbc2cbbaab9942a8d96c37bc
Time: 2020-09-29
Author: email@jasonphang.com
File Name: jiant/utils/torch_utils.py
Class Name:
Method Name: copy_state_dict
Project Name: explosion/thinc
Commit Name: cc8d7ba5562cb2335d975b67e88a81a6bc9b0f46
Time: 2020-01-12
Author: honnibal+gh@gmail.com
File Name: thinc/backends/_cupy_allocators.py
Class Name:
Method Name: cupy_pytorch_allocator
Project Name: rusty1s/pytorch_geometric
Commit Name: 314ee5916b0427e3cd27e017265e34d1b22da48f
Time: 2017-10-26
Author: janeric.lenssen@tu-dortmund.de
File Name: torch_geometric/nn/functional/spline_gcn/spline_gpu.py
Class Name: SplineWeightsGPU
Method Name: forward