1b5dd6e75723da209cc67c89b4446ac79a8070c5,tensorlayer/cost.py,,cosine_similarity,#Any#Any#,250

Before Change


    -----------
    a tensor of [batch_size, ]
    
    return tf.reduce_sum(tf.mul(v1, v2), reduction_indices=1) / (tf.sqrt(tf.reduce_sum(tf.mul(v1, v1), reduction_indices=1)) * tf.sqrt(tf.reduce_sum(tf.mul(v2, v2), reduction_indices=1)))



//// Regularization Functions

After Change


    a tensor of [batch_size, ]
    
    try: //// TF1.0
        cost = tf.reduce_sum(tf.multiply(v1, v2), 1) / (tf.sqrt(tf.reduce_sum(tf.multiply(v1, v1), 1)) * tf.sqrt(tf.reduce_sum(tf.multiply(v2, v2), 1)))
    except: //// TF0.12
        cost = tf.reduce_sum(tf.mul(v1, v2), reduction_indices=1) / (tf.sqrt(tf.reduce_sum(tf.mul(v1, v1), reduction_indices=1)) * tf.sqrt(tf.reduce_sum(tf.mul(v2, v2), reduction_indices=1)))
    return cost


//// Regularization Functions
def li_regularizer(scale, scope=None):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: tensorlayer/tensorlayer
Commit Name: 1b5dd6e75723da209cc67c89b4446ac79a8070c5
Time: 2017-02-04
Author: dhsig552@163.com
File Name: tensorlayer/cost.py
Class Name:
Method Name: cosine_similarity


Project Name: zsdonghao/text-to-image
Commit Name: 74796ff02e9425ca336f595978fe6e7c422c0378
Time: 2017-04-11
Author: dhsig552@163.com
File Name: tensorlayer/cost.py
Class Name:
Method Name: cosine_similarity


Project Name: tensorlayer/tensorlayer
Commit Name: 1b5dd6e75723da209cc67c89b4446ac79a8070c5
Time: 2017-02-04
Author: dhsig552@163.com
File Name: tensorlayer/cost.py
Class Name:
Method Name: cosine_similarity


Project Name: NifTK/NiftyNet
Commit Name: 7d9d506e77585e5600b45dc41da1a731a4b30722
Time: 2017-04-27
Author: z.eaton-rosen@ucl.ac.uk
File Name: nn/loss.py
Class Name:
Method Name: sensitivity_specificity_loss