I was trying to fine-tune resent 152 and I was using this piece of code:
> for param in list(model.parameters())[:-1]: > param.requires_grad = False
but I notice this was not working I changed it to :
> child_counter = 0 > for child in model.children(): > if child_counter < 9: > for param in child.parameters(): > param.requires_grad = False > child_counter += 1
it seems the second piece of code does the job, but I’m confiused, aren’t these two pieces of code doing the same thing ?