I have two tensors (OQ, OA) with shapes as below at the end of last layers in my model.
OQ shape: (1, 600)
OA shape: (1, 600)
These tensors are of type 'tensorflow.python.framework.ops.Tensor'
- How can we calculate cosine similarity and Euclidean distance for these tensors in Tensorflow 2.0?
- Do we get a tensor again or a single score value between [0,1]? Please help.
I tried this but not able to view the score.
score_cosine = tf.losses.cosine_similarity(tf.nn.l2_normalize(OQ, 0), tf.nn.l2_normalize(OA, 0))
print (score_cosine)
Output: Tensor("Neg_1:0", shape=(1,), dtype=float32)