I thought that the “feature” would be updated by the forward propagation on each loop, but it was not updated and the “feature” based on the first estimated data was fixed and output.
Therefore, I incorporated the forward_handle definition expression into the loop to achieve the behavior I wanted, but I don’t think this is a smart way to go about it.
Is this behavior a specification of register_forward_hook? If I am doing it wrong I would like your advice.
Thank you for the clarification.
I understand more about Pytorch now.
I have solved my issue by myself.
The cause was a very trivial mistake in fixing the index number when retrieving the output of the intermediate layer stored in a list object.