Multiple Classification Head CNN #7707
Closed
abhisuri97
started this conversation in
General
Replies: 2 comments
-
Hi @abhisuri97, did you try (Convert to the discussion, not related to the functionality in the core) |
Beta Was this translation helpful? Give feedback.
0 replies
-
Yes, that fixed it. Thanks for pointing it ou! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I am attempting to modify DenseNet121 to have multiple classification heads. However, when I'm computing the loss function, I get an error message saying that one of the variables has been modified by an inplace operation. The error and my initial thoughts/attempts to address the issue are at the bottom.
Here is my code:
Minorly modified DenseNet definition
Custom DenseNet121 with two classification heads (one that outputs a class and another that outputs contrast status)
Training loop
The error I get when I attempt to run it:
I know this is a huge dump of information. But I'm a bit clueless as to where to go from here. I haven't found any operations that were in place. The only thing that somewhat sticks out from the output is that there is a mention of the adaptive pool 3d function from torch. Notably, if I do convert this network back to having just one output (i.e. get rid of the out_contrast head in the definition of the custom densenet), it works absolutely fine. So there's definitely something about the multiple output nature of this network that is messing up the gradient computation.
Alternatively, if there is a way to implement having two classification heads in a CNN, it'd also be great to know about that.
Beta Was this translation helpful? Give feedback.
All reactions