My understanding is that matrix dot product between two 2x2 matrices will result in another 2x2 matrix.

However, the DotProduct example in Lesson 5 results in 2 element vector.

a = T([[1.,2],[3,4]])

b = T([[2.,2],[10,10]])

(a*b).sum(1)

Result:

6

70

[torch.FloatTensor of size 2]

The code example uses (a*b).len(1) to compute Dot Product:

class DotProduct(nn.Module):

def forward(self, u, m): return (u*m).sum(1)

Shouldn’t it be

[a b]. [w x] = [aw+by ax+bz]

[c d] [y z] [cw+dy cx+dz]

or in numpy: np.dot(a, b) resulting in:

array([[ 2., 4.],

[30., 40.]])