Does anyone know how to translate a vectorized version of ||x - w||^2 in pytorch? I have a working version in numpy but it seems there are issue with summing over axis in pytorch so I’m not sure how to translate my code to pytorch:
WW = np.sum(np.multiply(W,W), axis=0, dtype=None, keepdims=True)
XX = np.sum(np.multiply(x,x), axis=1, dtype=None, keepdims=True)
Delta_tilde = 2.0*np.dot(x,W) - (WW + XX)