for param in resnet50parameters paramrequires_grad = False
This code loops through all the parameters of the ResNet50 model and sets the requires_grad attribute to False. This means that the gradients for these parameters will not be computed during the backward pass and they will not be updated during the optimization step. Essentially, this code freezes the parameters of the ResNet50 model and prevents them from being trained.
原文地址: https://www.cveoy.top/t/topic/iNjl 著作权归作者所有。请勿转载和采集!