I have two tensors (batched sentences), v1: batch * seq_len1 * size, v2: batch * seq_len2 * size,
I want to implement this:
for each word x in v1:
for each word y in v2:
compute (x-y)^T(x-y)
Finally, I will get a matrix : batch * seq_len1 * seq_len2
How to implement this quickly?