Enhance error message when model fails to convert because of unsupported ops which can be handled using TF SELECT or require custom op implementation.
PiperOrigin-RevId: 347404307 Change-Id: Ie56cfae6a72be39b50291b13550296476ab37e3a
This commit is contained in:
parent
834cadde2e
commit
a12a2aa519
@ -1759,13 +1759,14 @@ Optional<std::string> Translator::TranslateInternal() {
|
||||
std::string err;
|
||||
if (!failed_flex_ops_.empty())
|
||||
err +=
|
||||
"Ops that can be supported by the flex runtime (enabled via setting "
|
||||
"the -emit-select-tf-ops flag):\n" +
|
||||
"Some ops are not supported by the native TFLite runtime, you can "
|
||||
"enable TF kernels fallback using TF Select. See instructions: "
|
||||
"https://www.tensorflow.org/lite/guide/ops_select" +
|
||||
failed_flex_ops_summary;
|
||||
if (!failed_custom_ops_.empty())
|
||||
err +=
|
||||
"Ops that need custom implementation (enabled via setting the "
|
||||
"-emit-custom-ops flag):\n" +
|
||||
"Some ops in the model are custom ops, See instructions to implement "
|
||||
"custom ops: https://www.tensorflow.org/lite/guide/ops_custom" +
|
||||
failed_custom_ops_summary;
|
||||
|
||||
auto& failed_region = named_regions[first_failed_func];
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
// CHECK: error: 'tf.MyCustomOp' op is neither a custom op nor a flex op
|
||||
// CHECK: error: failed while converting: 'main'
|
||||
// CHECK: Ops that need custom implementation (enabled via setting the -emit-custom-ops flag):
|
||||
// CHECK: Some ops in the model are custom ops, See instructions to implement
|
||||
// CHECK: tf.MyCustomOp {name = "MyCustomOp"}
|
||||
|
||||
func @main(tensor<4xf32>) -> tensor<4xf32> {
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
// CHECK: error: 'tf.Div' op is neither a custom op nor a flex op
|
||||
// CHECK: error: failed while converting: 'main'
|
||||
// CHECK: Ops that can be supported by the flex runtime (enabled via setting the -emit-select-tf-ops flag):
|
||||
// CHECK: Some ops are not supported by the native TFLite runtime
|
||||
// CHECK: tf.Div {name = "div"}
|
||||
|
||||
func @main(tensor<4xf32>) -> tensor<4xf32> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user