AttributeError: 'function' object has no attribute ...
github.com › yitong91 › StoryGANJul 14, 2019 · It prompts AttributeError: 'function' object has no attribute 'parameters'. (There is no problem if I only set 1 GPU.) I have also checked PyTorch docs at https://pytorch.org/docs/stable/_modules/torch/nn/parallel/data_parallel.html. It seems that the first argument for nn.parallel.data_parallel should be a module, instead of a function.
AttributeError: 'Model' object has no attribute 'parameters ...
discuss.pytorch.org › t › attributeerror-modelMay 26, 2021 · AttributeError: 'Model' object has no attribute 'parameters'. I am using a modified Resnet18, with my own pooling function at the end of the Resnet. resnet = resnet18 ().cuda () #a modified resnet class Model (): def __init__ (self, model, pool): self.model = model self.pool= pool #my own pool class which has trainable layers def forward (self, sample): output = self.model (sample) output = self.pool (output) output = F.normalize (output, p=2, dim=1) return output.