Add failure reproducer

In the case of failed conversion, this produces a reproducer from the start of
the converter pipeline that can be run with `tf-opt` and debugged more easily.

PiperOrigin-RevId: 347735476
Change-Id: I9a5c7dfab8723bb53875351534e21cfa4add015b
This commit is contained in:
Jacques Pienaar 2020-12-15 18:46:40 -08:00 committed by TensorFlower Gardener
parent 029b72e374
commit c1e9462055
2 changed files with 3 additions and 0 deletions

View File

@ -22,6 +22,7 @@ cc_library(
"//tensorflow/compiler/mlir/lite:tf_to_tfl_flatbuffer",
"//tensorflow/compiler/mlir/tensorflow",
"//tensorflow/compiler/mlir/tensorflow:convert_graphdef",
"//tensorflow/compiler/mlir/tensorflow:dump_mlir_util",
"//tensorflow/compiler/mlir/tensorflow:mlir_roundtrip_flags",
"//tensorflow/core:core_cpu_base",
"//tensorflow/core:lib",

View File

@ -30,6 +30,7 @@ limitations under the License.
#include "tensorflow/compiler/mlir/lite/transforms/passes.h"
#include "tensorflow/compiler/mlir/tensorflow/translate/import_model.h"
#include "tensorflow/compiler/mlir/tensorflow/translate/mlir_roundtrip_flags.h"
#include "tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.h"
#include "tensorflow/core/framework/graph.pb.h"
#include "tensorflow/core/framework/types.pb.h"
#include "tensorflow/core/lib/core/errors.h"
@ -302,6 +303,7 @@ Status ConvertMLIRToTFLiteFlatBuffer(
mlir::PassManager pm(module->getContext(),
mlir::OpPassManager::Nesting::Implicit);
::tensorflow::SetCrashReproducer(pm);
tensorflow::AddTFToTFLConversionPasses(pass_config, &pm, session);
// Convert back to outlined while format for export back to flatbuffer.