What is the proper way of using last_epoch in a lr_scheduler?

Could you provide a small code snippet resulting in this error?
Did the approach from the other thread not work?