[Relax][PyTorch] CrossEntropyLoss#17863
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.
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.
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.
Sounds good, I will undo that and also update #17862
There was a problem hiding this comment.
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.
Nightly tests are located at tests/python/nightly.
There was a problem hiding this comment.
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.
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.
Would be better to include a test case for functional cross entropy.
There was a problem hiding this comment.
@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.