Skip to content

Conversation

@shingjan
Copy link

@shingjan shingjan commented Jun 24, 2022

This PR intends to add the following five ops for the pytorch frontend:

Note that arguments to the above ops will be changed by relay at runtime so verify_model won't work on them.

cc: @masahi @junrushao1994 @zxybazh

Copy link
Member

@masahi masahi left a comment

Choose a reason for hiding this comment

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

Please add tests. If verify_model cannot be used, we can always manually compile, set input, and run.

@shingjan
Copy link
Author

@masahi Tests are added. Should be good to take another look.

@shingjan shingjan requested a review from masahi June 29, 2022 07:44
@shingjan
Copy link
Author

@tvm-bot rerun

@masahi masahi merged commit 41c94b2 into apache:main Jun 29, 2022
@shingjan
Copy link
Author

@masahi It is possible that tests for empty and empty_like are flaky. It failed on CI once but by reading the outputs it shouldn't fail. Just to give a heads-up.

@masahi
Copy link
Member

masahi commented Jun 30, 2022

Did they ever fail in your local testing?

@shingjan
Copy link
Author

@masahi Local testing no. But there is one CI failure:
https://ci.tlcpack.ai/blue/rest/organizations/jenkins/pipelines/tvm/branches/PR-11896/runs/9/nodes/383/steps/1174/log/?start=0

This is the stacktrace:

[2022-06-29T08:34:53.751Z] _______________________________ test_empty_like ________________________________
[2022-06-29T08:34:53.751Z] 
[2022-06-29T08:34:53.751Z]     def test_empty_like():
[2022-06-29T08:34:53.751Z]         def test_func(data):
[2022-06-29T08:34:53.751Z]             return torch.empty_like(data)
[2022-06-29T08:34:53.751Z]     
[2022-06-29T08:34:53.751Z] >       verify_model_with_input(test_func, [torch.rand([1, 3, 10, 10]).float()])
[2022-06-29T08:34:53.751Z] 
[2022-06-29T08:34:53.751Z] tests/python/frontend/pytorch/test_forward.py:3827: 
[2022-06-29T08:34:53.751Z] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[2022-06-29T08:34:53.751Z] tests/python/frontend/pytorch/test_forward.py:221: in verify_model_with_input
[2022-06-29T08:34:53.751Z]     tvm.testing.assert_allclose(baseline_outputs, compiled_output, rtol=1e-5, atol=1e-5)
[2022-06-29T08:34:53.751Z] python/tvm/testing/utils.py:113: in assert_allclose
[2022-06-29T08:34:53.751Z]     np.testing.assert_allclose(actual, desired, rtol=rtol, atol=atol, verbose=True)
[2022-06-29T08:34:53.751Z] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[2022-06-29T08:34:53.751Z] 
[2022-06-29T08:34:53.751Z] x = array([[[[ 7.7170313e-17,  0.0000000e+00,  5.3485164e-26,
[2022-06-29T08:34:53.751Z]            0.0000000e+00,  0.0000000e+00,  0.0000000e+00,
[2022-06-29T08:34:53.751Z]   ...  0.0000000e+00,
[2022-06-29T08:34:53.751Z]            0.0000000e+00,  0.0000000e+00,  0.0000000e+00,
[2022-06-29T08:34:53.751Z]            0.0000000e+00]]]], dtype=float32)
[2022-06-29T08:34:53.751Z] y = array([[[[0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[2022-06-29T08:34:53.751Z]          [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[2022-06-29T08:34:53.751Z]          [0., 0....         [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[2022-06-29T08:34:53.751Z]          [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]]]], dtype=float32)
[2022-06-29T08:34:53.751Z] func = <ufunc 'isnan'>, hasval = 'nan'
[2022-06-29T08:34:53.751Z] 

looks like those two tensors should pass the allclose test but they failed on CI anyway

@driazati
Copy link
Member

it's since failed a few times on main, I filed #11968 to disable it until there is a fix

@shingjan shingjan deleted the torch_new_ops branch July 5, 2022 22:58
blackkker pushed a commit to blackkker/tvm that referenced this pull request Jul 7, 2022
…n::pad, aten::reshape_as and atem::empty_like (apache#11896)

* add new ops

* fix pad

* fix pad

* remove pad

* fix CI

* remove doc

* fix fill_

* add tests
masahi pushed a commit to masahi/tvm that referenced this pull request Jul 15, 2022
…n::pad, aten::reshape_as and atem::empty_like (apache#11896)

* add new ops

* fix pad

* fix pad

* remove pad

* fix CI

* remove doc

* fix fill_

* add tests
mikeseven pushed a commit to mikeseven/tvm that referenced this pull request Sep 27, 2023
…n::pad, aten::reshape_as and atem::empty_like (apache#11896)

* add new ops

* fix pad

* fix pad

* remove pad

* fix CI

* remove doc

* fix fill_

* add tests
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.

3 participants