Skip to content

[TFTRT] Add Dynamic Shape Testing and fix Explicit Batch Mode for ConvertUnpack - #48049

Merged
copybara-service[bot] merged 1 commit into
tensorflow:masterfrom
DEKHTIARJonathan:jdekhtiar/dynamic_shape/ConvertUnpack
Mar 26, 2021
Merged

copybara-service[bot] merged 1 commit into
tensorflow:masterfrom
DEKHTIARJonathan:jdekhtiar/dynamic_shape/ConvertUnpack

Conversation

@DEKHTIARJonathan

@DEKHTIARJonathan DEKHTIARJonathan commented Mar 24, 2021 •

Copy link
Copy Markdown
Contributor

Fixed ConvertSplitHelper to make ConvertUnpack work for explicit batch mode.
Add dynamic shape testing for ConvertUnpack.

@bixia1 @tfeher for review

Feature Tracker: #45481

@google-ml-butler google-ml-butler Bot added the size:L CL Change Size: Large label Mar 24, 2021
@google-cla google-cla Bot added the cla: yes label Mar 24, 2021
@google-ml-butler
google-ml-butler Bot requested a review from joker-eph March 24, 2021 19:03
Comment on lines +5148 to +5149
if (! params->validation_only){
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not needed?

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.

Indeed debug leftovers. Removing

if (! params->validation_only){
}
}
if (params->validation_only) return Status::OK();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I should remove this for these reasons:
The SqueezeTensor converter can handle validataion_only mode.
The SqueezeTensor converter may return error, in that case, we should not convert and returning Status::OK() here premature and wrong.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

SqueezeTensor seems to handle validation_only mode, but in practice we do not use it for validation in any other converter. I believe we cannot use it here either:

  • The first arg (params->outputs->at(i)) is not created by ConvertStridedSliceHelper during validation.
  • I am not sure if params->converter exists in validation_mode.

#endif
// We need to skip error testing for Dynamic Shape mode, as it is impossible
// to convert Unpack in Dynamic Shape Mode.
// `Unimplemented: Strided slice op not implemented for dynamic shape input`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry, I don't understand this line. What is the purpose of this line?

@DEKHTIARJonathan DEKHTIARJonathan Mar 25, 2021 •

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.

Error expected from the converter if you try dynamic shape inputs.
Removing it

@gbaned gbaned self-assigned this Mar 25, 2021
@gbaned gbaned added the comp:gpu:tensorrt Issues specific to TensorRT label Mar 25, 2021
@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

@bixia1 bixia1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The added test didn't pass:

third_party/tensorflow/compiler/tf2tensorrt/convert/convert_nodes_test.cc:129
No Diff
Inline Diff
Line Diff
Token Diff
Char Diff
Ignore White Space
Value of: status.error_message()
Expected: has substring "Dimension 3 of size 3 is not evenly divisble by 2, at my_split"
Actual: "Dimension 3 of size 3 is not evenly divisible by 2, at my_split"
Invalid argument: Dimension 3 of size 3 is not evenly divisible by 2, at my_split
Stack trace:
0x55fb2b36f5ad: tensorflow::tensorrt::convert::ExpectStatus(tensorflow::Status, tensorflow::error::Code, char const*) @ ../sysdeps/x86_64/start.S:121
0x55fb2b385435: tensorflow::tensorrt::convert::OpConverterTest::RunValidationAndConversion(tensorflow::NodeDef const&, tensorflow::error::Code, char const*, bool) @ ??:??
0x55fb2b3da77e: tensorflow::tensorrt::convert::OpConverterTest_ConvertSplit_Test::TestBody() @ ??:??
0x55fb2c886521: testing::Test::Run() @ ??:??
0x55fb2c8877ee: testing::TestInfo::Run() @ ??:??
... Google Test internal frames ...

third_party/tensorflow/compiler/tf2tensorrt/convert/convert_nodes_test.cc:129
No Diff
Inline Diff
Line Diff
Token Diff
Char Diff
Ignore White Space
Value of: status.error_message()
Expected: has substring "Dimension 3 of size 3 is not evenly divisble by 4, at my_split"
Actual: "Dimension 3 of size 3 is not evenly divisible by 4, at my_split"
Invalid argument: Dimension 3 of size 3 is not evenly divisible by 4, at my_split
Stack trace:
0x55fb2b36f5ad: tensorflow::tensorrt::convert::ExpectStatus(tensorflow::Status, tensorflow::error::Code, char const*) @ ../sysdeps/x86_64/start.S:121
0x55fb2b385435: tensorflow::tensorrt::convert::OpConverterTest::RunValidationAndConversion(tensorflow::NodeDef const&, tensorflow::error::Code, char const*, bool) @ ??:??
0x55fb2b3da8f0: tensorflow::tensorrt::convert::OpConverterTest_ConvertSplit_Test::TestBody() @ ??:??
0x55fb2c886521: testing::Test::Run() @ ??:??
0x55fb2c8877ee: testing::TestInfo::Run() @ ??:??
... Google Test internal frames ...

@bixia1 bixia1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I fixed the test.

@google-ml-butler google-ml-butler Bot added the kokoro:force-run Tests on submitted change label Mar 25, 2021
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Mar 25, 2021
@DEKHTIARJonathan

Copy link
Copy Markdown
Contributor Author

I fixed the test.

Thanks Bixia

@copybara-service
copybara-service Bot merged commit 94f92c9 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:L CL Change Size: Large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants