I just encountered an error, when I perform a bool slices operation like:
average = torch.mean(tensor[tensor[:] != 0]),
the system returns me an error: Function ‘AddmmBackward’ returned nan values in its 2th output.
I realized that this equation may not be a differentiable function, so I was wondering if there is a differentiable way can let me get the same result as the equation stated above.
This operation is fine. Note that you don’t need the [:].
This error occurs when you run in AnomalyMode? You should check which forward function it correspond to and print the output value to make sure they are in acceptable ranges.