Thanks for the explanation.
In the first approach, I don’t need to allocate memory every time, so it will be a little bit faster? And it is written in that way to see if Mode.zero_grad is always safe.
And later self.out will be used to compute the loss, and I need to backpropagate from the loss  to the Model’s parameters through self.out. In this case, it seems that self.out will need meaningful gradient for the chain rule to work?