I want to apply torch.optim.lr_scheduler.CosineAnnealingWarmRestarts() to my self-defining optimizer. However, the error occurs TypeError: XXX is not an Optimizer(XXX is my custom optimizer). I creat my optimizer by modifying torch.optim.SGD and it works well. How to solve this problem?