Hi
I am a beginner in Pytorch. are these two codes the same? In fact, i am confused does the second code work correctly and each weight will update properly.
first:
model = models.resnet101(pretrained=False)
opt = optim.SGD(model.parameters(), lr=lr, momentum=0.8)

second:
model = models.resnet101(pretrained=False)

parameters = model.parameters()
weights = []
for name, param in model.named_parameters():
    if name.endswith('weight'):
        weights.append(param)
weight_id = list(map(id, weight_parameters))
other_parameters = list(filter(lambda param: id(param) not in weights_id, parameters))

opt = optim.SGD([{'params' : other_parameters},
            {'params' : weights}], lr=lr, momentum=0.9)