How to calculate second derivative gradients for mixed precision. I try calling backward() twice but it gave the same gradients as first derivative.
self.scaler.scale(loss).backward()
self.scaler.scale(loss).backward()
How to calculate second derivative gradients for mixed precision. I try calling backward() twice but it gave the same gradients as first derivative.
self.scaler.scale(loss).backward()
self.scaler.scale(loss).backward()
Calling backward
multiple times will calculate the same gradients and accumulate them.
You would need to backward the derivatives again as described in this post.