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


        // 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
        return tf.matrix_diag(tf.reshape(x, (-1, self.dim)))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

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: SheffieldML/GPy
Commit Name: af286ba5280614ecc8371b71ed53cc6447d1183b
Time: 2016-04-22
Author: ibinbei@gmail.com
File Name: GPy/kern/src/static.py
Class Name: Precomputed
Method Name: Kdiag


Project Name: deepfakes/faceswap
Commit Name: 7bdaa81cbef16d3626b3044bfe5c279120a9c0a0
Time: 2019-09-28
Author: 36920800+torzdf@users.noreply.github.com
File Name: lib/model/initializers.py
Class Name: ConvolutionAware
Method Name: _symmetrize


Project Name: ysig/GraKeL
Commit Name: 22174935d2771cca41cf10dc75bfccf9169451a6
Time: 2018-03-01
Author: y.siglidis@gmail.com
File Name: grakel/kernels/neighborhood_subgraph_pairwise_distance.py
Class Name: neighborhood_subgraph_pairwise_distance
Method Name: fit_transform