-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[Relax][PyTorch] CrossEntropyLoss #17863
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
Conversation
| assert_torch_output_vs_tvm_from_exported_to_cuda(raw_data, torch_module, target, dev) | ||
|
|
||
|
|
||
| @tvm.testing.parametrize_targets("cuda") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not confident whether we need e2e tests for every ops.
The upside is we may not have to care about pytorch incompatible API update such as #17680 we hit recently.
The downside is that they increase the CI pressure, which results in a slow development speed.
Maybe nightly is a good place for e2e tests?
cc @Hzfengsy @tqchen @yongwww
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree we should avoid exccessive e2e tests and infavor of unit tests, we should move the execution based tests to something likely a nightly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, I will undo that and also update #17862
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One reason why I added those tests is that we already had support for torch.sort (with a unit test), but when I tested e2e I realized that we had differerent behavior than pytorch. Maybe it's worth it indeed to add those tests to nightly? If so, what is the way to do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nightly tests are located at tests/python/nightly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved the e2e tests to nightly in #17907 (the commits are also in this PR to avoid future conflicts)
mshr-h
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CrossEntropyLoss support looks good to me.
|
@mshr-h @tqchen @MasterJH5574 I removed the e2e tests. |
|
|
||
|
|
||
| def test_cross_entropy(): | ||
| class CrossEntropyModule(Module): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be better to include a test case for functional cross entropy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mshr-h I added a e2e test case in the nightly tests (last lines of tests/python/nightly/test_nnapi/test_from_exported_to_cuda.py).
Please let me know if that addresses your concern.
Fix reduction for sort and cross-entropy
* tests for add'l modules * no sort * cross entropy test passes * cleanup * fix expand * remove new e2e tests * remove new e2e tests * convert e2e test to unit test * unit test * restore tests * move * add new tests * add new tests from 17862 * whitespace * print statemetns * all tests pass * cleanup - all tests still pass * cleanup. All nightly tests pass
Add support for nn.CrossEntropyLoss in exported program translator.
general_reduction.py would fail when the reduction would reduce to a scalar. This PR allows the last block being a scalar.