2026a8939d9ccc3e26ac776db5b4788846fd166c,dnc/sparse_memory.py,SparseMemory,write_into_sparse_memory,#SparseMemory#Any#,124

Before Change


    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

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()
    for b in range(positions.size(0)):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

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


Project Name: rusty1s/pytorch_geometric
Commit Name: 6437d4e459e0f56e059ef0400c03852ef91b8a32
Time: 2018-08-13
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/nn/pool/consecutive.py
Class Name:
Method Name: consecutive_cluster


Project Name: ixaxaar/pytorch-dnc
Commit Name: c9eb3a5ca7cc2f2eeb30219477fbf87bde23e360
Time: 2017-12-09
Author: root@ixaxaar.in
File Name: dnc/sparse_memory.py
Class Name: SparseMemory
Method Name: write