For example, I have such a forward function():
def forward(self, x):
mgdata = self.encoder(x)
self.imp_mask_sigmoid = self.impmap_sigmoid(mgdata)
self.imp_mask = self.impmap_expand(self.imp_mask_sigmoid)
enc_data = mgdata * self.imp_mask
dec_data = self.decoder(enc_data)
return dec_data
When I using dataparallel, I always using model.module
to access the wrapped original model.However, I found I can’t access model.module.imp_mask_sigmoid
, it will complain about AttributeError: 'ContentWeightedCNN' object has no attribute 'imp_mask_sigmoid'
.
How to deal with it?
Thanks very much.