SGD has no attribute CyclicLR

(Niklas Hildebrandt) #1

Hi, I’m having issues with implementing the cyclical learning rate policy. When I my code, I get the error message that ‘SGD’ object has no attribute ‘CyclicLR’. I have checked to ensure that I have the nightly version. I have followed the example given in the docs,

optim = torch.optim.SGD(model.parameters(), lr=0.1, momentum=0.9)
scheduler = torch.optim.CyclicLR(optim)

my import is as follows
from torch.optim.lr_scheduler import StepLR, ExponentialLR, CyclicLR

Any help would be appreciated :slight_smile:

(Niklas Hildebrandt) #2

Solved this myself, realized that i just needed to write CyclicLR(optim) without the torch.optim