We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code added in #370 contains a bug to do with negative zero.
Test case:
#[test] fn test_max_negative_zero() { let dev: TestDevice = Default::default(); let t = dev.tensor([[-0.0, 0.0], [0.0, -0.0], [-0.0, -1.0], [0.0, -1.0]]); let r = t.trace().max::<_, Axis<1>>(); assert_eq!(r.array(), [0.0, 0.0, -0.0, 0.0]); let g = r.sum().backward(); assert_eq!( g.get(&t).array(), [[1.0, 1.0], [1.0, 1.0], [1.0, 0.0], [1.0, 0.0]] ); }
This test passes on cpu, but with the test-cuda feature it gives this failure:
test-cuda
---- tensor_ops::max_to::tests::test_max_negative_zero stdout ---- thread 'tensor_ops::max_to::tests::test_max_negative_zero' panicked at 'assertion failed: `(left == right)` left: `[0.0, 0.0, -1.0, 0.0]`, right: `[0.0, 0.0, -0.0, 0.0]`', src\tensor_ops\max_to\mod.rs:144:9
This bug was mentioned in the StackOverflow page from which the code for the kernel was taken, along with a suggested fix: https://stackoverflow.com/a/72461459/10514840
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Code added in #370 contains a bug to do with negative zero.
Test case:
This test passes on cpu, but with the
test-cuda
feature it gives this failure:This bug was mentioned in the StackOverflow page from which the code for the kernel was taken, along with a suggested fix: https://stackoverflow.com/a/72461459/10514840
The text was updated successfully, but these errors were encountered: