UserWarning: Detected call of `lr_scheduler.step()` before `optimizer.step()`

thanks @ptrblck
before commenting here i was using

if new_scaler == old_scaler:
    scheduler.step()

and then i saw the last comment of this post `optimizer.step()` before `lr_scheduler.step()` error using GradScaler - #10 by rdutta and thought i was doing wrong.