Open n-garc opened 1 year ago
According to https://www.tensorflow.org/api_docs/python/tf/UnconnectedGradients, this is intended behavior to show that the source and target are unconnected and therefore have 0 gradients. It might be useful to wrap the gradients call in a try
block and raise an exception with this information.
I'm not sure why my source and target are unconnected, going to keep digging.
I have a tf 2.10 3DConv ANN with multiple regression outputs (model architecture at the end). I am attempting to use this package to generate gradcam++ heatmaps and I am getting the following error:
I am using a custom Score class: RegressionScore:
The offending line is
grads = tape.gradient(score_values, penultimate_output, unconnected_gradients=unconnected_gradients)
. I have confirmed that score_values is a list of positive valued tensors and that penultimate_output is the output of the last conv layer.Even using CategoricalScore on 5 sample videos I get the same error: