Thank you for the reply. That is for the implementation of CheXnet on X-ray images which uses a sigmoid. As for the initialisation. I simply instantiate the model and uses .cuda
Edit: I almost forgot, I do remove the last layer of densenet121 and add an layer that doesn’t change the input
class Identity(nn.Module):
    def __init__(self):
        super(Identity, self).__init__()
        
    def forward(self, x):
        return x

dense_net = DenseNet121(12)
dense_net.classifier = nn.Sequential(Identity())
custom_net = CustomNet(dense_net, dense_net.in_features)
custom_net = custom_net.cuda(0)

I even checked the model parameters with is_cuda, they return true…I checked the type of the input which is torch.cuda.FloatTensor. The error occurs within the conv layer of self.features(x) in densenet121. Thanks