I would like to get the normalized dot product of 2 matrices using Theano. By normalized dot product of 2 matrices, I define the normalized inner product of 2 vectors as the following: Take v_a from matrix A, and vector v_b from matrix B. AB__dot_norm = v_a * v_b / |v_a| |v_b|.
I can get the norm of v_a and v_b with the following code. I am not sure how to normalize the dot_product matrix with the normalized vectors.
import theano
from theano import tensor
dot_product = tensor.dot(in_tensor, w_tensor)
in_normalized = in_tensor / in_tensor.norm (2, axis = 1).reshape(in_tensor.shape[0],1)
w_normalized = w_tensor / w_tensor.norm (2, axis = 0).reshape(1, w_tensor.shape[1])