(x, y)
return 1 - tf.matmul(x, y, transpose_b=True)
Computes the exact cosine distance.
Computes the exact cosine distance.
Computes the exact cosine distance .
def exact_cosine_distance(x, y):
  """Computes the exact cosine distance."""
  x = tf.nn.l2_normalize(x, 1, epsilon=1e-3)
  y = tf.nn.l2_normalize(y, 1, epsilon=1e-3)
  return 1 - tf.matmul(x, y, transpose_b=True)
def exact_cosine_distance ( x , y ) : x = tf . nn . l2_normalize ( x , 1 , epsilon = 1e-3 ) y = tf . nn . l2_normalize ( y , 1 , epsilon = 1e-3 ) return 1 - tf . matmul ( x , y , transpose_b = True )