nadam = torch.optim.NAdam(model.parameters())
This gives the error AttributeError: module 'torch.optim' has no attribute 'NAdam'. My PyTorch version is '1.9.1+cu102', the python version is 3.7.11. VS code does not even suggest the optimizer but the documentation clearly mentions the optimizer. I can import other optimizers like Adam
>Solution :
https://pytorch.org/docs/1.9.1/optim.html
From the official website, NAdam is not among the optimizers in pytorch v 1.9.1.
Try upgrading to v 1.10.0, and your code should work just fine.