Hi,
I am somewhat of a beginner to pytorch. I am implementing a paper where they have a classification CNN (input -> convolutional layers -> dense layers -> output). However, each filter of the final convolutional layer has its own loss calculation. During back-propagation, the gradient of the final loss of the network output is summed with the gradient of the loss for each particular filter. This is then back-propagated to lower convolutional layers as per usual.
I have no idea how to implement something like this. I have only ever implemented pre-defined loss functions (e.g. nn.CrossEntropyLoss()) and only for the final output of the network.
Do you have any suggestions of how to get started?