Skip to content

TF-TRT Prefer static shapes - #48060

Merged
copybara-service[bot] merged 1 commit into
tensorflow:masterfrom
tfeher:trt_prefer_static_shapes
Mar 26, 2021
Merged

copybara-service[bot] merged 1 commit into
tensorflow:masterfrom
tfeher:trt_prefer_static_shapes

Conversation

@tfeher

@tfeher tfeher commented Mar 24, 2021 •

Copy link
Copy Markdown
Contributor

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 the profile_strategy graph attribute, and pass it to TrtShapeOptimizationProfiles during the InitProfiles call. Additionally an IsStaticCompatible method is introduced to TrtShapeOptimizationProfiles, and is used in TRTEngineOp::BuildEngine to decide whether to build a dynamic or a static engine.

Tracker #45481
Tagging @bixia1 for review and @DEKHTIARJonathan

@google-ml-butler google-ml-butler Bot added the size:M CL Change Size: Medium label Mar 24, 2021
@google-ml-butler
google-ml-butler Bot requested a review from joker-eph March 24, 2021 23:22
@google-cla google-cla Bot added the cla: yes label Mar 24, 2021
@gbaned gbaned self-assigned this Mar 25, 2021
@gbaned gbaned added the comp:gpu:tensorrt Issues specific to TensorRT label Mar 25, 2021
@tfeher
tfeher force-pushed the trt_prefer_static_shapes branch from 1870688 to 97c83ec Compare March 25, 2021 16:47
@tfeher

tfeher commented Mar 25, 2021

Copy link
Copy Markdown
Contributor Author

I have updated the lowercase name handling and fixed one error in trt_engine_op_test.

@google-ml-butler google-ml-butler Bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Mar 25, 2021
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Mar 25, 2021
@copybara-service
copybara-service Bot merged commit 0907666 into tensorflow:master Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes comp:gpu:tensorrt Issues specific to TensorRT ready to pull PR ready for merge process size:M CL Change Size: Medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants