Remove if_mlir_tflite build flag.

PiperOrigin-RevId: 264920065
This commit is contained in:
Nupur Garg 2019-08-22 14:29:25 -07:00 committed by TensorFlower Gardener
parent eca82b24c2
commit 91eeb068b1
3 changed files with 4 additions and 27 deletions

View File

@ -1,5 +1,5 @@
load("//tensorflow:tensorflow.bzl", "tf_py_wrap_cc")
load("//tensorflow:tensorflow.bzl", "if_mlir_tflite", "py_binary", "tf_py_test")
load("//tensorflow:tensorflow.bzl", "py_binary", "tf_py_test")
package(
default_visibility = [
@ -22,10 +22,6 @@ cc_library(
name = "toco_python_api",
srcs = ["toco_python_api.cc"],
hdrs = ["toco_python_api.h"],
defines = if_mlir_tflite(
if_false = [],
if_true = ["TFLITE_BUILD_WITH_MLIR_CONVERTER"],
),
visibility = [
"//tensorflow/python:__subpackages__",
],
@ -39,6 +35,7 @@ cc_library(
"//tensorflow/lite/toco:toco_port",
"//tensorflow/lite/toco:toco_tooling",
"//tensorflow/core:protos_all_cc",
"//tensorflow/compiler/mlir/lite/python:graphdef_to_tfl_flatbuffer",
] + select({
# This is required when running `tflite_convert` from `bazel`.
# It requires to link with TensorFlow Ops to get the op definitions.
@ -46,10 +43,7 @@ cc_library(
"//tensorflow/core:ops",
],
"//conditions:default": [],
}) + if_mlir_tflite(
if_false = [],
if_true = ["//tensorflow/compiler/mlir/lite/python:graphdef_to_tfl_flatbuffer"],
),
}),
)
# Compatibility stub. Remove when internal customers moved.

View File

@ -18,6 +18,7 @@ limitations under the License.
#include <string>
#include <vector>
#include "tensorflow/compiler/mlir/lite/python/graphdef_to_tfl_flatbuffer.h"
#include "tensorflow/core/platform/logging.h"
#include "tensorflow/lite/python/interpreter_wrapper/python_utils.h"
#include "tensorflow/lite/toco/import_tensorflow.h"
@ -28,11 +29,6 @@ limitations under the License.
#include "tensorflow/lite/toco/toco_tooling.h"
#include "tensorflow/lite/toco/toco_types.h"
#if defined(TFLITE_BUILD_WITH_MLIR_CONVERTER)
#include "tensorflow/compiler/mlir/lite/python/graphdef_to_tfl_flatbuffer.h"
#endif
#include "tensorflow/core/protobuf/graph_debug_info.pb.h"
namespace toco {
// NOTE(aselle): We are using raw PyObject's here because we want to make
@ -124,18 +120,9 @@ PyObject* TocoConvert(PyObject* model_flags_proto_txt_raw,
// Convert model.
if (enable_mlir_converter) {
#if defined(TFLITE_BUILD_WITH_MLIR_CONVERTER)
status = tensorflow::ConvertGraphDefToTFLiteFlatBuffer(
model_flags, toco_flags, debug_info, graph_def,
&output_file_contents_txt);
#else
// TODO(b/124314620): Remove this condition.
PyErr_SetString(PyExc_RuntimeError,
"This flag is not supported by this version of the "
"TFLite converter. This functionality is being "
"actively worked on.");
return nullptr;
#endif
} else {
model = toco::Import(toco_flags, model_flags, input_contents_txt);
toco::Transform(toco_flags, model.get());

View File

@ -2556,9 +2556,5 @@ def if_mlir(if_true, if_false = []):
"//tensorflow:with_mlir_support": if_true,
})
# TODO(b/138724071): Remove when build is stable.
def if_mlir_tflite(if_true, if_false = []):
return if_true # Internally we always build with MLIR.
def tfcompile_extra_flags():
return ""