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

[Relay, TOPI] Refactor Adaptive pool and add 3d support #5049

Merged
merged 16 commits into from
Mar 15, 2020

Conversation

masahi
Copy link
Member

@masahi masahi commented Mar 12, 2020

I'm trying to load resnet 3D from torchvision using torch frontend, and for that I need adaptive avg pool 3d. I refactored the existing topi 2d impl to work with N dimensional input, and added Relay boilerplate for the new 3d version.

please review @kevinthesun @icemelon9 @anijain2305 @jwfromm

@masahi
Copy link
Member Author

masahi commented Mar 12, 2020

@kevinthesun Can you take a look at this? This is for extending adaptive pool op you added in #3085

@kevinthesun
Copy link
Contributor

@masahi I'll take a look during the weekend.

Copy link
Contributor

@jwfromm jwfromm left a comment

Choose a reason for hiding this comment

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

Looks great! Left one comment but otherwise I can't find anything that needs to be changed.

topi/tests/python/test_topi_pooling.py Show resolved Hide resolved
@masahi
Copy link
Member Author

masahi commented Mar 14, 2020

@kevinthesun Thanks, the diff is not small, but it is due to Relay boilerplate that were mostly copy-pasted from 2d version. The only interesting bits is cpp topi refactoring.

I also finished adding 3d model support in our torch frontend, buidling on this PR. We can now load and run resnet 3D from torchvision. I believe this is the first time TVM runs on 3D workload end to end.

The diff between this PR is here masahi/tvm@adaptive-pool-3d...masahi:torch-3d

cc @jwfromm @optima2005

@masahi
Copy link
Member Author

masahi commented Mar 14, 2020

@jwfromm You can easily add adaptive pool 1d, if there is such use case.

Copy link
Contributor

@kevinthesun kevinthesun left a comment

Choose a reason for hiding this comment

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

LGTM

@masahi masahi merged commit 7c5ff50 into apache:master Mar 15, 2020
@masahi
Copy link
Member Author

masahi commented Mar 15, 2020

Thanks @kevinthesun @jwfromm

trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Apr 16, 2020
* add stub for nd impl

* refactored indices compute

* refactored divide step

* remove unused variables, add doc

* fix lint

* add relay op def

* add python registration

* refactor topi test

* update relay tests, but test result is weird

* workaround for weird bug

* add relay adaptive pool 3d test

* add topi tests

* update doc for 3d

* typo fix

* fix lint

* add more tests including NDHWC
zhiics pushed a commit to neo-ai/tvm that referenced this pull request Apr 17, 2020
* add stub for nd impl

* refactored indices compute

* refactored divide step

* remove unused variables, add doc

* fix lint

* add relay op def

* add python registration

* refactor topi test

* update relay tests, but test result is weird

* workaround for weird bug

* add relay adaptive pool 3d test

* add topi tests

* update doc for 3d

* typo fix

* fix lint

* add more tests including NDHWC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants