Hello, i create a CNN model like this global_model = CNNMnist(args=args). Then i send it to device, set it to train. Then i train my local models, collect the local_weights and the average them to get updated global_model.
Now i am trying to get the items from the .parameters() function but all i get is None as item.grad. When i do the same thing for the local_models, i get the desired output. What am i doing wrong?
global_model.to(device)
global_model.train()
...................
global_weights = average_weights(local_weights)
global_model.load_state_dict(global_weights)
last_update = []
for item in global_model.parameters():
    last_update.append(copy.deepcopy(item.grad))
    print(item.grad)

Output: None None None None None None None None
Any help would be appreciated.