d6a2e55cea7640cf6ab1250bbaba66dd79a7ee85,pymc3/theanof.py,BatchedDiag,perform,#BatchedDiag#Any#Any#Any#Any#,475
Before Change
C1 = np.concatenate([[0], C.flatten()])
bc = C.shape[0]
dim = C.shape[-1]
diag_idx = np.arange(1, dim + 1)
index = np.diag(diag_idx)[None, ...]
index = np.repeat(index, bc, 0)
inc = np.repeat(
np.arange(0, C.size, C.shape[1]).reshape((-1, 1)),
C.shape[1], 1
)
index[index.nonzero()] += inc.flatten()
z[0] = C1[index]
def grad(self, inputs, gout):
(gz,) = gout
After Change
bc = C.shape[0]
dim = C.shape[-1]
Cd = np.zeros((bc, dim, dim), C.dtype)
bidx = np.repeat(np.arange(bc), dim)
didx = np.tile(np.arange(dim), bc)
Cd[bidx, didx, didx] = C.flatten()
z[0] = Cd
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: pymc-devs/pymc3
Commit Name: d6a2e55cea7640cf6ab1250bbaba66dd79a7ee85
Time: 2017-09-02
Author: maxim.v.kochurov@gmail.com
File Name: pymc3/theanof.py
Class Name: BatchedDiag
Method Name: perform
Project Name: reinforceio/tensorforce
Commit Name: 6d5623b632166e67ef7dff441df5432d06b05e8d
Time: 2016-11-20
Author: k@ifricke.com
File Name: tensorforce/replay_memories/replay_memory.py
Class Name: ReplayMemory
Method Name: sample_batch
Project Name: rusty1s/pytorch_geometric
Commit Name: b6a7c304c68fe4a1300970459a3807ee7bce6c87
Time: 2018-05-22
Author: matthias.fey@tu-dortmund.de
File Name: examples/cora.py
Class Name:
Method Name: