6e58890709c68a24c2773cb744804362aef4a23b,dnc/memory.py,Memory,allocate,#Memory#Any#Any#,83
Before Change
// essential for correct scaling of allocation_weights to prevent memory pollution
// during write operations
// https://discuss.pytorch.org/t/cumprod-exclusive-true-equivalences/2614/8
v = var(T.ones(batch_size, 1))
if self.gpu_id != -1:
v = v.cuda(self.gpu_id)
cat_sorted_usage = T.cat((v, sorted_usage), 1)[:, :-1]
prod_sorted_usage = fake_cumprod(cat_sorted_usage, self.gpu_id)
sorted_allocation_weights = (1 - sorted_usage) * prod_sorted_usage.squeeze()
After Change
// cumprod with exclusive=True
// https://discuss.pytorch.org/t/cumprod-exclusive-true-equivalences/2614/8
v = var(sorted_usage.data.new(batch_size, 1).fill_(1))
cat_sorted_usage = T.cat((v, sorted_usage), 1)
prod_sorted_usage = T.cumprod(cat_sorted_usage, 1)[:, :-1]
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 3
Instances
Project Name: ixaxaar/pytorch-dnc
Commit Name: 6e58890709c68a24c2773cb744804362aef4a23b
Time: 2017-11-12
Author: root@ixaxaar.in
File Name: dnc/memory.py
Class Name: Memory
Method Name: allocate
Project Name: pytorch/audio
Commit Name: 0e0d1e590e8cdae50d04a96617ea6601446f99fb
Time: 2018-12-25
Author: david@da3.net
File Name: torchaudio/transforms.py
Class Name: PadTrim
Method Name: __call__
Project Name: BindsNET/bindsnet
Commit Name: 1ee6d86439ca85e5c8d6bf5f8112668b8b63de77
Time: 2019-07-28
Author: danjsaund@gmail.com
File Name: bindsnet/conversion/conversion.py
Class Name: SubtractiveResetIFNodes
Method Name: reset_
Project Name: ixaxaar/pytorch-dnc
Commit Name: 89c379db757a53851145180a3437b6b110334a7c
Time: 2017-11-12
Author: root@ixaxaar.in
File Name: dnc/memory.py
Class Name: Memory
Method Name: allocate