def cosine_similarity(v1, v2):
 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))))

def cosine_similarity ( v1 , v2 ) : 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 ) ) ) )
returns the cosine similarity of the given vectors .