Notice that addmm_ is the in-place version of addmm, and it’s a bound method.
output.addmm_(0, 1, input, weight.t()) is actually translated to torch.Tensor.addmm_(0, output, 1, input, weight.t()).
The fact that is an in-place method implies that the result will be written to the same tensor output the method was called with.
Therefore what happens there is that output becomes 0 * output + 1 * input @ weight.t()