'NoneType' object has no attribute 'parameters' - PyTorch Forums
discuss.pytorch.org › t › nonetype-object-has-noNov 06, 2021 · Below is the training function I am writing, yet, there is this error: ‘NoneType’ object has no attribute ‘parameters’. I don’t really know how to solve it. def train(net, train_loader, test_loader, logger): # TODO: Define the SGD optimizer here. Use hyper-parameters from cfg optimizer = optim.SGD(net.parameters(),lr=cfg['lr'],momentum=cfg['momentum'],weight_decay=cfg['weight_decay'], nesterov=cfg['nesterov']) # TODO: Define the criterion (Objective Function) that you will ...