Skip to content

[BYOC][TRT] Support batch norm for all ranks <=5, and all axes#7026

Merged
zhiics merged 3 commits into
apache:mainfrom
trevor-m:trt-batchnorm-enhance
Dec 8, 2020
Merged

[BYOC][TRT] Support batch norm for all ranks <=5, and all axes#7026
zhiics merged 3 commits into
apache:mainfrom
trevor-m:trt-batchnorm-enhance

Conversation

@trevor-m

@trevor-m trevor-m commented Dec 3, 2020

Copy link
Copy Markdown
Contributor

Previous batch norm only supported rank 4 inputs with axis 1 or 3. Now we support input ranks and axes 1-5.

@trevor-m trevor-m force-pushed the trt-batchnorm-enhance branch 2 times, most recently from ae0c87b to 27982b8 Compare December 3, 2020 19:47
Comment thread python/tvm/relay/op/contrib/tensorrt.py
@trevor-m

trevor-m commented Dec 3, 2020

Copy link
Copy Markdown
Contributor Author

All tests in test_tensorrt.py passed locally

@trevor-m trevor-m force-pushed the trt-batchnorm-enhance branch from c03ece8 to f51f808 Compare December 4, 2020 16:45
auto input_dims = TrtDimsToVector(input->getDimensions());
const size_t min_rank = TRT_HAS_IMPLICIT_BATCH(params) ? 3 : 4;
const size_t max_rank = TRT_HAS_IMPLICIT_BATCH(params) ? 4 : 5;
ICHECK_LE(input_dims.size(), max_rank);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you convert these checks to use Diagnostic instead of generating an assertion, we should strive to replace most of these with end-user readable errors.

@trevor-m trevor-m Dec 7, 2020

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi @jroesch, thanks for reviewing!

These checks are more for sanity checking, since the annotation functions in python/tvm/relay/op/contrib/tensorrt.py will filter out the unsupported ops before they ever get to this code. I don't expect users to ever see these.

Anyway, I can make a separate PR to port all of the ICHECK to Diagnostics.

@zhiics zhiics left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Let's have a separate PR to migrate all errors to diagnostic.

@zhiics zhiics merged commit 0095b21 into apache:main Dec 8, 2020
@zhiics

zhiics commented Dec 8, 2020

Copy link
Copy Markdown
Member

Thanks @trevor-m @anijain2305 @jroesch

TusharKanekiDey pushed a commit to TusharKanekiDey/tvm that referenced this pull request Jan 20, 2021
…e#7026)

* [TRT] Support batch norm for all ranks <=5, and all axis

* Add return false

* Fix TRT < 6 build
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Jan 21, 2021
…e#7026)

* [TRT] Support batch norm for all ranks <=5, and all axis

* Add return false

* Fix TRT < 6 build
electriclilies pushed a commit to electriclilies/tvm that referenced this pull request Feb 18, 2021
…e#7026)

* [TRT] Support batch norm for all ranks <=5, and all axis

* Add return false

* Fix TRT < 6 build
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.

4 participants