Hİ @ptrblck, thank you for your answer. I have a few followup questions about what you say.


The inside_loss parameter requries gradient however inside the batch, I am summing that inside_loss values and create the “loss” variable. So, the loss not requires any gradient. Because of that I used that one and then commented out it. What should I do?


You are saying that “The usage of .data is dangerous”, however I am using a code like x = x_prime; is it dangerous too?


And the last one; yes the “backward a second time” is meaningful; however if I “detach” the tensor inside_loss; how can I took the backward of it? It means “take the inside_loss out of the graph”, isn’t it?


Thank you for your answers;
Have a nice day.