maybe its not so related…
if i have loss = loss1 + loss2
loss1 need to do a lot of sampling to get, is it correct to do something like this
for sample times:
     loss1 = get_loss1() / sample_times
     loss1.backward(retain_graph = True)

loss2.backward()
...
optimize.steps()

thanks!!