Hi,
This has nothing to do with matmul.
.detach() or .data are used to explicitly ask to break the computational graph, and thus prevent gradients from flowing. So if you add these in the middle of your network, no gradients will flow back and your network won’t be able to learn.