Skip to content
New issue

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

Powf fix2 #1193

Merged
merged 4 commits into from
Jan 31, 2024
Merged

Powf fix2 #1193

merged 4 commits into from
Jan 31, 2024

Conversation

skewballfox
Copy link
Contributor

Pull Request Template

Checklist

  • Confirmed that run-checks all script has been executed.
  • Made sure the book is up to date with changes in this PR.

Related Issues/PRs

None

Changes

Fixes for powf wgpu function from pr #1184, splitting out so they can be merged

Testing

added a new test for powf under burn-tensor, first test has an element pair that confirms 0^0 works.

I realized candle wasn't being tested, and started testing it, encountered the same issue as before (0^0) being Nan instead of 1. I'm making an issue now, will link once I'm done

Copy link

codecov bot commented Jan 30, 2024

Codecov Report

Attention: 20 lines in your changes are missing coverage. Please review.

Comparison is base (02259ea) 84.47% compared to head (cac2e82) 84.44%.

❗ Current head cac2e82 differs from pull request most recent head c3d9da9. Consider uploading reports for the commit c3d9da9 to get more accurate results

Files Patch % Lines
burn-wgpu/src/codegen/function.rs 69.23% 20 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1193       /-   ##
==========================================
- Coverage   84.47%   84.44%   -0.03%     
==========================================
  Files         548      549        1     
  Lines       61811    61905       94     
==========================================
  Hits        52216    52277       61     
- Misses       9595     9628       33     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@louisfd louisfd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one issue we have to figure out, the rest is all good!

let pow = Data::from([[0.0, 1.0, 2.0], [3.0, 4.0, 5.0]]);
let tensor_pow = Tensor::<TestBackend, 2>::from_data(pow, &Default::default());
let data_actual = tensor.powf(tensor_pow).into_data();
let data_expected = Data::from([[1.0, 1.0, 4.0], [27.0, 256.0, 3125.0]]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding what you just said on discord,

So, I realized the issue with wgpu(and candle) might be effecting other test. assert_approx_eq seems to auto pass pairs if either one of them is NaN. looking into it its because any comparison with NaN is false, so the branch err>tol is never true

I think we should not test 0^0 = 1 here, because once we fix assert_approx_eq the test is gonna start failing. We could add a specific test for this after but it's complicated if it's not the same answer on all backend. And the right answer is debatable, I actually think NaN is truer than 1

@nathanielsimard nathanielsimard merged commit 07c69bd into tracel-ai:main Jan 31, 2024
9 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants