Tensor.prod
returns a NaN when there is a negative value in the tensor
#2509
Labels
bug
Something isn't working
Describe the bug
The
prod
andprod_dim
tensor operation results contain NaN values if there is a negative value in the tensor performing the operation. This was tested with both ndarray and tch backends.To Reproduce
Expected behavior
Result should be [-1620] instead of NaN.
Screenshots
Desktop (please complete the following information):
Additional context
The
prod
method calls thefloat_log
implementation for the NdArray Backend which basically takes the natural log of the tensor's data, the result is then summed and the exponent taken.Naturally the natural log of a negative number is undefined, explaining the NaN.
With pytorch however, negative numbers are catered for.
If this is desired behaviour this issue should be closed.
Edit: Not able to reproduce for the
Tch
Backend,NdArray
however still returning NaN valuesThe text was updated successfully, but these errors were encountered: