Fine tuning resnet: 'DataParallel' object has no attribute 'fc'

When using DataParallel your nn.Module will be in .module:

model = Net()
model.fc

model_parallel = nn.DataParallel(model)
model_parallel.module.fc
11 Likes