Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR improves TF-TRT conversion when the "Optimal" profile generation strategy is used with only a single input shape.
In that case the TRT engine would have a single profile with min=opt=max. This means that the engine should only handle the concrete input dimension defined by the single profile. Therefore, we can define the TRT network with static shapes. This increases conversion rate, because some of our converters are not able to convert dynamic shape input.
This PR updates
TRTEngineOp
constructor to retrieve theprofile_strategy
graph attribute, and pass it toTrtShapeOptimizationProfiles
during theInitProfiles
call. Additionally anIsStaticCompatible
method is introduced toTrtShapeOptimizationProfiles
, and is used inTRTEngineOp::BuildEngine
to decide whether to build a dynamic or a static engine.Tracker #45481
Tagging @bixia1 for review and @DEKHTIARJonathan