2026a8939d9ccc3e26ac776db5b4788846fd166c,dnc/sparse_memory.py,SparseMemory,write_into_sparse_memory,#SparseMemory#Any#,124
Before Change
pos = positions.data.cpu().numpy()
for b in range(positions.size(0)):
// update sparse memory
for i, p in enumerate(list(pos[b])):
hidden["memory"][b, p] = read_vectors[b, i]
// update indexes
hidden["indexes"][b].add(read_vectors[b], positions[b])
hidden["last_used_mem"][b] = (int(pos[b][-1]) + 1) if (pos[b][-1] + 1) < self.mem_size else 0
return hidden
After Change
(b, m, w) = hidden["memory"].size()
// update memory
hidden["memory"].scatter_(1, positions.unsqueeze(2).expand(b, self.K+1, w), read_vectors)
// non-differentiable operations
pos = positions.data.cpu().numpy()
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
Project Name: ixaxaar/pytorch-dnc
Commit Name: 2026a8939d9ccc3e26ac776db5b4788846fd166c
Time: 2017-12-03
Author: root@ixaxaar.in
File Name: dnc/sparse_memory.py
Class Name: SparseMemory
Method Name: write_into_sparse_memory
Project Name: ixaxaar/pytorch-dnc
Commit Name: 2026a8939d9ccc3e26ac776db5b4788846fd166c
Time: 2017-12-03
Author: root@ixaxaar.in
File Name: dnc/sparse_memory.py
Class Name: SparseMemory
Method Name: read_from_sparse_memory
Project Name: SPFlow/SPFlow
Commit Name: 82478ffacdd98fcc0750ff086af240a3f37a8b10
Time: 2019-08-22
Author: steven.lang.mz@gmail.com
File Name: src/spn/algorithms/layerwise/layers.py
Class Name: Product
Method Name: forward