Repository navigation
TF-TRT Improve reshape op converter - #40545
Conversation
318b5c4 to
8f64eab
Compare
|
@tfeher This PR is in draft, any update on this? Please. Thanks! |
|
I am working on an update that would enable the missing python test for this feature. It shall be ready by next week. |
|
@tfeher This PR is in draft, any update on this? Please. Thanks! |
35f68f2 to
f6f0f81
Compare
|
I have updated the PR, it is ready for review. |
|
@tfeher Any update on this PR? Please. Thanks! |
|
There is an issue with the converter using TRT 7.1.3. I am working on a fix. |
|
@tfeher Any update on this PR? and please resolve conflicts Thanks! |
|
The unit test of the converter fails in explicit batch mode with TRT 7.1.3 due to a bug in TRT. Waiting for feedback from the TRT team. |
|
I got three tests failed: |
|
tensorflow/compiler/tf2tensorrt:convert_nodes_test_gpu also failed |
tfeher
left a comment
There was a problem hiding this comment.
Thanks @bixia1 for the review. I have corrected the smaller issues. I am looking into the python test problems.
The C++ test seem to have a problem with ConvertConv3D. I could not reproduce that wint TRT 7.2.1, but I will have a look with other versions.
There seem to be an additional issue with shape value handling in TRT6. I will investigate, and disable conversion in the affected versions.
|
bixia1
left a comment
There was a problem hiding this comment.
Per offline conversation, approving this for testing inside google while Tamas is still working on the python tests.
|
I found the reason for the Conv3D failure. This line of code is accessing garbage value when c_index == 4, and for implicit batch mode. |
|
Thanks @bixia1 for looking into the Conv3D failure, I will add a fix in this PR. The last commit seems to solve the problem with the with the two neighbor engine tests. There is still an issue with the combined_nms_test.py, I am looking into that. |
bixia1
left a comment
There was a problem hiding this comment.
Approving this so that I can get it to google and test it while Tamas is still working on one failing test.
- Add profile management for shape input tensors - Allow scalars for TRT6 or above - Improve engine serialization test. Additionally improve shape value handling. Adapt to Shape IO API change in TRT 7.1.3. - Disable ConvertDynamicReshape befor TRT 7.1.3 - Fix Conv3D channel index in implicit batch mode - Update CombinedNMS scalar value check
23dd7c8 to
47ef8f0
Compare
This PR improves the Reshape op converter to handle explicit batch and dynamic shape input data.
Since TRT6, IShuffleLayer has an option to accept the shape parameter as an input tensor. If the shape input tensor corresponds to an input tensor of the TRTEngineOp, then we need to specify the input shape values for the engine. Additionally we need to specify optimization profile parameters for the shape values. The necessary changes were implemented in TrtShapeOptimizationProfile, TRTEngineOp, trt_engine_utils.
The unit tests have only a single op, and therefore handling shape input values are required to test
reshape with tensor input shape. In normal network it is less likely to have shape input tensors.
Additionally the handling of scalar input/output shapes are improved.
C++ test for serialization / deserialization of input shapes and shape values added.
Note: TensorRT has a function INetworkDefinition::markOutputForShapes which could enable the output tensor's value to be computed by IExecutionContext::getShapeBinding. This is not used in this PR, but it might be useful for shape inference.