133699c2f33302e124d31811844a6f24decadcd6,keras/engine/topology.py,Merge,call,#Merge#Any#Any#,1144

Before Change


            return output

        elif self.mode == "cos":
            if K._BACKEND != "theano":
                raise Exception(""cos" merge mode will only work with Theano.")
            from theano import tensor as T
            l1 = inputs[0]
            l2 = inputs[1]
            denominator = T.sqrt(T.batched_tensordot(l1, l1, self.dot_axes) *
                                 T.batched_tensordot(l2, l2, self.dot_axes))
            output = T.batched_tensordot(l1, l2, self.dot_axes) / denominator
            output = output.dimshuffle((0, "x"))
            return output
        else:
            raise Exception("Unknown merge mode.")

After Change


            denominator = K.sqrt(K.batch_dot(l1, l1, self.dot_axes) *
                                 K.batch_dot(l2, l2, self.dot_axes))
            output = K.batch_dot(l1, l2, self.dot_axes) / denominator
            output = K.expand_dims(output, 1)
            return output
        else:
            raise Exception("Unknown merge mode.")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: keras-team/keras
Commit Name: 133699c2f33302e124d31811844a6f24decadcd6
Time: 2016-04-01
Author: eder@macbook.com
File Name: keras/engine/topology.py
Class Name: Merge
Method Name: call


Project Name: keras-team/keras
Commit Name: 4e5348c5cab9842d8508375d3b6bf06b97d9db50
Time: 2016-03-23
Author: eder@macbook.com
File Name: keras/layers/core.py
Class Name: Siamese
Method Name: get_output_dot


Project Name: keras-team/keras
Commit Name: 4e5348c5cab9842d8508375d3b6bf06b97d9db50
Time: 2016-03-23
Author: eder@macbook.com
File Name: keras/layers/core.py
Class Name: Siamese
Method Name: get_output_cos