You might not be aware of the functional versions of the basic modules. For example, you use the nn.Linear class in your example. You could use the functional variant 68 which requires no initialisation step. You just call it when you need it with data and weights.
output = torch.nn.functional.linear(input, weight, bias)