Add github template and request op compatibility bug reports.

New template is for tf lite operation compatibility.
Exporter now prints a message referring to this templat.

PiperOrigin-RevId: 218921105
This commit is contained in:
Andrew Selle 2018-10-26 15:10:25 -07:00 committed by TensorFlower Gardener
parent f5a99d5272
commit 6448bb3248
6 changed files with 23 additions and 0 deletions

View File

@ -438,6 +438,8 @@ tensorflow::Status Export(
}
}
// The set of used builtin ops.
std::set<string> builtin_ops;
// The set of custom ops (not including Flex ops).
std::set<string> custom_ops;
// The set of Flex ops which are not supported.
@ -451,6 +453,10 @@ tensorflow::Status Export(
if (key.is_unsupported_flex_op()) {
unsupported_flex_ops.insert(key.flex_tensorflow_op());
}
if (!key.is_custom_op() && !key.is_flex_op() &&
!key.is_unsupported_flex_op()) {
builtin_ops.insert(EnumNameBuiltinOperator(key.type()));
}
}
if (!custom_ops.empty()) {
@ -471,18 +477,32 @@ tensorflow::Status Export(
custom_ops_final = custom_ops;
}
auto please_report_bug_message = []() {
return "We are continually in the process of adding support to "
"TensorFlow Lite for more ops. It would be helpful if you could "
"inform us of how this conversion went by opening a github "
"issue at "
"https://github.com/tensorflow/tensorflow/issues/new?template="
"40-tflite-op-request.md\n and pasting the following:\n\n";
};
if (params.allow_flex_ops) {
return tensorflow::errors::InvalidArgument(absl::StrCat(
please_report_bug_message(),
"Some of the operators in the model are not supported by "
"the standard TensorFlow Lite runtime and are not recognized by "
"TensorFlow. If you have a custom "
"implementation for them you can disable this error with "
"--allow_custom_ops, or by setting allow_custom_ops=True "
"when calling tf.contrib.lite.TFLiteConverter(). Here is a list "
"of builtin operators you are using: ",
absl::StrJoin(builtin_ops, ", "),
". Here is a list "
"of operators for which you will need custom implementations: ",
absl::StrJoin(custom_ops_final, ", "), "."));
} else {
return tensorflow::errors::InvalidArgument(absl::StrCat(
please_report_bug_message(),
"Some of the operators in the model are not supported by "
"the standard TensorFlow Lite runtime. If those are native "
"TensorFlow operators, you might be able to use the extended "
@ -492,6 +512,9 @@ tensorflow::Status Export(
"custom implementation for them you can disable this error with "
"--allow_custom_ops, or by setting allow_custom_ops=True "
"when calling tf.contrib.lite.TFLiteConverter(). Here is a list "
"of builtin operators you are using: ",
absl::StrJoin(builtin_ops, ", "),
". Here is a list "
"of operators for which you will need custom implementations: ",
absl::StrJoin(custom_ops_final, ", "), "."));
}