74796ff02e9425ca336f595978fe6e7c422c0378,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: 5

Non-data size: 7

Instances


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: reinforceio/tensorforce
Commit Name: f4cd4dcf2ced26e55dc53cf51dfa9affd38a511f
Time: 2018-01-27
Author: mi.schaarschmidt@gmail.com
File Name: tensorforce/models/pg_model.py
Class Name: PGModel
Method Name: tf_reward_estimation


Project Name: dpressel/mead-baseline
Commit Name: 78eba7b3f82b8420deac3cd28318dbfead0f9b9e
Time: 2018-10-30
Author: dpressel@gmail.com
File Name: python/baseline/pytorch/seq2seq/model.py
Class Name: Seq2SeqModel
Method Name: encode


Project Name: aertslab/pySCENIC
Commit Name: 4fa15dade9f2174a602a28682d2f1013dba3ef78
Time: 2018-05-09
Author: vandesande.bram@gmail.com
File Name: src/pyscenic/binarization.py
Class Name:
Method Name: _derive_threshold


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