5809cb0b339612434f4f332a91a2cd3e4570c34d,gpflow/transforms.py,LowerTriangular,backward_tensor,#LowerTriangular#Any#,392

Before Change


        CAVEAT: Requires defined shape and can"t work with unknown shape.
        
        size = np.prod(y.shape.as_list())
        N = int(np.sqrt(size / self.num_matrices))
        reshaped = tf.reshape(y, shape=(self.num_matrices, N, N))
        indices = np.array([np.hstack(x) for x in
                            itertools.product(np.arange(self.num_matrices), np.dstack(np.tril_indices(N))[0])])
        triangular = tf.reshape(tf.gather_nd(reshaped, indices), shape=[-1])
        return triangular

After Change


        
        if self.squeeze:
            y = tf.expand_dims(y, axis=0)
        indices = np.vstack(np.tril_indices(self.N)).T
        indices = itertools.product(np.arange(self.num_matrices), indices)
        indices = np.array([np.hstack(x) for x in indices])
        triangular = tf.gather_nd(y, indices)
        return tf.reshape(triangular, [self.num_matrices, (self.N**2 + self.N) // 2])
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: GPflow/GPflow
Commit Name: 5809cb0b339612434f4f332a91a2cd3e4570c34d
Time: 2018-02-26
Author: james@prowler.io
File Name: gpflow/transforms.py
Class Name: LowerTriangular
Method Name: backward_tensor


Project Name: danforthcenter/plantcv
Commit Name: 02003918155f6290ff207a01d6485f2066fd35b6
Time: 2019-06-18
Author: haleyschuhl@gmail.com
File Name: plantcv/plantcv/object_composition.py
Class Name:
Method Name: object_composition


Project Name: commonsense/conceptnet5
Commit Name: f1fc699be9ce8b249cf5bd670d2200f990a5294d
Time: 2016-09-09
Author: rob@luminoso.com
File Name: conceptnet5/vectors/evaluation/analogy.py
Class Name:
Method Name: eval_analogies


Project Name: IndicoDataSolutions/finetune
Commit Name: 2ad9e8af614767e645c4358ae1e2444f02d4573b
Time: 2018-08-22
Author: madison@indico.io
File Name: finetune/sequence_labeling.py
Class Name: SequenceLabeler
Method Name: predict