TensorRT icon indicating copy to clipboard operation
TensorRT copied to clipboard

Support shape analysis for dynamic fallback

Open Njuapp opened this issue 2 years ago • 1 comments

Signed-off-by: Cheng Hang [email protected]

Description

Previously, when encountered ops/modules that have to fall back and meanwhile dynamic shape is used, shape analysis would fail when doing generateRandomInputs(), because tensors with -1 contained in shape cannot be created.

To support dynamic fallback, we have to firstly overcome this failure, by doing generateRandomInputs() with min/max/opt shape info. Then shape analysis can be executed three times, with min/max/opt shapes correspondingly.

Fixes #1113

Type of change

Please delete options that are not relevant and/or add your own.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist:

  • [x] My code follows the style guidelines of this project (You can use the linters)
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas and hacks
  • [x] I have made corresponding changes to the documentation
  • [x] I have added tests to verify my fix or my feature
  • [x] New and existing unit tests pass locally with my changes
  • [x] I have added the relevant labels to my PR in so that relevant reviewers are notified

Njuapp avatar Jun 13 '22 09:06 Njuapp

I think this feature needs a formal design. Please open an RFC for this. For example just through discussion about this feature one issue we thought of is that TensorRT has limitations in number of free dimensions in dynamic shape for some layers. We should augment the converter library to report these cases back so that we can check for support before moving forward. I suspect there are other similar cases

narendasan avatar Jun 17 '22 00:06 narendasan