f4559a3d47510f776b3e38d5aceb07ee4b4b0ea9,gpflow/transforms.py,DiagMatrix,backward,#DiagMatrix#Any#,277

Before Change


    def backward(self, y):
        // Return diagonals of matrices
        x = y.reshape(-1, self.dim, self.dim).diagonal(0, 1, 2).flatten()
        return self._positive_transform.backward(x)

    def forward_tensor(self, x):
        y = self._positive_transform.forward_tensor(x)
        return tf.matrix_diag(tf.reshape(y, (-1, self.dim)))

After Change



    def backward(self, y):
        // Return diagonals of matrices
        if not (y.shape[1] == y.shape[2] == self.dim) and (len(y.shape) == 3):
            raise ValueError("shape of input does not match this transform")
        return y.diagonal(offset=0, axis1=1, axis2=2).flatten()

    def forward_tensor(self, x):
        // create diagonal; matrices
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: GPflow/GPflow
Commit Name: f4559a3d47510f776b3e38d5aceb07ee4b4b0ea9
Time: 2017-11-24
Author: james@prowler.io
File Name: gpflow/transforms.py
Class Name: DiagMatrix
Method Name: backward


Project Name: HewlettPackard/dlcookbook-dlbs
Commit Name: ac368987658176719fab4039d5d0e04942eead71
Time: 2019-06-24
Author: sergey.serebryakov@hpe.com
File Name: python/mxnet_benchmarks/benchmarks.py
Class Name:
Method Name: run_n_times


Project Name: rusty1s/pytorch_geometric
Commit Name: 3735f4b48f52f7703944f36284b9e9ee3d1e8e5f
Time: 2020-10-27
Author: matthias.fey@tu-dortmund.de
File Name: examples/tgn.py
Class Name:
Method Name: train