Copy the ``.grad`` attribute from stored references to fp16 parameters to the ``.grad`` attribute of the fp32 master parameters that are directly updated by the optimizer. :attr:`update_master_grads` only needs to be called if ``fp16_optimizer_obj.backward`` was
(self)
| 541 | self.update_master_grads() |
| 542 | |
| 543 | def update_master_grads(self): |
| 544 | """ |
| 545 | Copy the ``.grad`` attribute from stored references to fp16 parameters to |
| 546 | the ``.grad`` attribute of the fp32 master parameters that are directly |
| 547 | updated by the optimizer. :attr:`update_master_grads` only needs to be |
| 548 | called if ``fp16_optimizer_obj.backward`` was called with |
| 549 | ``update_master_grads=False``. |
| 550 | """ |
| 551 | self._model_grads_to_master_grads() |
| 552 | |
| 553 | self.overflow = self.loss_scaler.unscale_and_update(self.param_groups, |
| 554 | self.loss_scale) |
| 555 | |
| 556 | # Promote loss scale so it can be retrieved or set via |
| 557 | # "fp16_optimizer_instance.loss_scale" |
no test coverage detected