Here is what I suspect happens, though I couldn’t find the code to match it: torch.matmul() starts off by initializing a matrix of the correct output size filled with zeroes. It then iterates over the relevant dimensions of the two input matrices, computes the various dot products, and replaces each zero in the output matrix with the correct dot product. Once this iteration is done, it returns the output matrix which is now the product. This is how we would write simple code for matrix multiplication.
In this case, since there is nothing to iterate over, the zeroes remain as they are and we get a matrix of the correct size filled with zeroes.