60dfcf812eca79017dced46e1189245c050a3fd6,dl/callbacks.py,OptimizerCallback,on_batch_end,#OptimizerCallback#Any#,393
Before Change
assert len(state._optimizer) == 1, \
"fp16 mode works only with one optimizer for now"
for key, value in state.loss.items():
scaled_loss = self.fp16_grad_scale * value.float()
scaled_loss.backward()
master_params = list(
state._optimizer["main"].param_groups[0]["params"])
model_params = list(filter(
lambda p: p.requires_grad,
After Change
optimizer=optimizer,
optimizer_wd=self.optimizer_wd,
grad_clip_fn=self.grad_clip_fn)
model.zero_grad()
self.accumulation_counter = 0
else:
model = state.model
model.zero_grad()
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 3
Instances
Project Name: Scitator/catalyst
Commit Name: 60dfcf812eca79017dced46e1189245c050a3fd6
Time: 2018-12-10
Author: scitator@gmail.com
File Name: dl/callbacks.py
Class Name: OptimizerCallback
Method Name: on_batch_end
Project Name: Scitator/catalyst
Commit Name: 18a49ac9e89dec811ffb604a699750ac88f86907
Time: 2018-11-02
Author: scitator@gmail.com
File Name: dl/callbacks.py
Class Name: OptimizerCallback
Method Name: on_batch_end
Project Name: pytorch/text
Commit Name: 89f2c2b125815fc11849ae110b4b561de81894d2
Time: 2019-07-31
Author: 6156351+zhangguanheng66@users.noreply.github.com
File Name: examples/text_classification/train.py
Class Name:
Method Name: train
Project Name: HyperGAN/HyperGAN
Commit Name: d78a6f10ce5360c49d25166c4acb1e4ccb32734d
Time: 2020-02-07
Author: martyn@255bits.com
File Name: hypergan/trainers/alternating_trainer.py
Class Name: AlternatingTrainer
Method Name: _step