With numpy, I can do a simple matrix multiplication like this:
a = numpy.ones((3, 2))
b = numpy.ones((2, 1))
result = a.dot(b)
However, this does not work with PyTorch:
a = torch.ones((3, 2))
b = torch.ones((2, 1))
result = torch.dot(a, b)
This code throws the following error:
RuntimeError: 1D tensors expected, but got 2D and 2D tensors
How do I perform matrix multiplication in PyTorch?