aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Yu-Cheng Ling <ycling@google.com>2018-09-27 16:19:09 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-09-27 16:33:31 -0700
commit2330933ddd0b29ad206e351c9120e621cdaf6312 (patch)
treec617ed415b787d276619fcd19f32b6aa1e133453
parent5f67bf69d3f53d1cd3bb86ebeeb03ea2bba5911b (diff)
Rename TFLite Extended -> TFLite Flex
PiperOrigin-RevId: 214854303
-rw-r--r--tensorflow/contrib/lite/build_def.bzl4
-rw-r--r--tensorflow/contrib/lite/model.cc4
-rw-r--r--tensorflow/contrib/lite/python/convert.py8
-rw-r--r--tensorflow/contrib/lite/python/lite_test.py4
-rw-r--r--tensorflow/contrib/lite/testing/generate_examples.py10
-rw-r--r--tensorflow/contrib/lite/testing/model_coverage/model_coverage_lib_test.py2
-rw-r--r--tensorflow/contrib/lite/tools/benchmark/BUILD4
-rw-r--r--tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.cc8
-rw-r--r--tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.h8
9 files changed, 26 insertions, 26 deletions
diff --git a/tensorflow/contrib/lite/build_def.bzl b/tensorflow/contrib/lite/build_def.bzl
index 7f5c6bdc2f..7ef26de69f 100644
--- a/tensorflow/contrib/lite/build_def.bzl
+++ b/tensorflow/contrib/lite/build_def.bzl
@@ -301,7 +301,7 @@ def generated_test_conversion_modes():
"""Returns a list of conversion modes."""
# TODO(nupurgarg): Add "pb2lite" when it's in open source. b/113614050.
- return ["toco-extended", ""]
+ return ["toco-flex", ""]
def generated_test_models_all():
"""Generates a list of all tests with the different converters.
@@ -335,7 +335,7 @@ def gen_zip_test(name, test_name, conversion_mode, **kwargs):
# TODO(nupurgarg): Comment in when pb2lite is in open source. b/113614050.
# if conversion_mode == "pb2lite":
# toco = "//tensorflow/contrib/lite/experimental/pb2lite:pb2lite"
- flags = "--ignore_toco_errors --run_with_extended"
+ flags = "--ignore_toco_errors --run_with_flex"
kwargs["tags"].append("skip_already_failing")
kwargs["tags"].append("no_oss")
kwargs["tags"].append("notap")
diff --git a/tensorflow/contrib/lite/model.cc b/tensorflow/contrib/lite/model.cc
index eff6181a61..d50c345194 100644
--- a/tensorflow/contrib/lite/model.cc
+++ b/tensorflow/contrib/lite/model.cc
@@ -27,7 +27,7 @@ limitations under the License.
#ifndef TFLITE_MCU
#include "tensorflow/contrib/lite/nnapi_delegate.h"
#endif
-#if defined(TFLITE_EXTENDED)
+#if defined(TFLITE_FLEX)
#include "tensorflow/contrib/lite/delegates/flex/delegate.h"
#endif
#include "tensorflow/contrib/lite/version.h"
@@ -450,7 +450,7 @@ TfLiteStatus InterpreterBuilder::operator()(
}
(**interpreter).SetVariables(std::move(variables));
-#if defined(TFLITE_EXTENDED)
+#if defined(TFLITE_FLEX)
if (auto delegate = FlexDelegate::Create()) {
(**interpreter)
.ModifyGraphWithDelegate(std::move(delegate),
diff --git a/tensorflow/contrib/lite/python/convert.py b/tensorflow/contrib/lite/python/convert.py
index 73a420c47b..613a1530f7 100644
--- a/tensorflow/contrib/lite/python/convert.py
+++ b/tensorflow/contrib/lite/python/convert.py
@@ -67,12 +67,12 @@ class ConverterMode(enum.Enum):
# Convert model using TOCO such that only unsupported operations are
# represented as TensorFlow ops.
# WARNING: Experimental interface, subject to change.
- TOCO_EXTENDED = "TOCO_EXTENDED"
+ TOCO_FLEX = "TOCO_FLEX"
# Convert model using TOCO such that all operations are represented as
# TensorFlow ops.
# WARNING: Experimental interface, subject to change.
- TOCO_EXTENDED_ALL = "TOCO_EXTENDED_ALL"
+ TOCO_FLEX_ALL = "TOCO_FLEX_ALL"
def __str__(self):
return self.value
@@ -240,9 +240,9 @@ def build_toco_convert_protos(input_tensors,
if dump_graphviz_dir:
toco.dump_graphviz_dir = dump_graphviz_dir
toco.dump_graphviz_include_video = dump_graphviz_video
- if converter_mode == ConverterMode.TOCO_EXTENDED:
+ if converter_mode == ConverterMode.TOCO_FLEX:
toco.allow_flex_ops = True
- elif converter_mode == ConverterMode.TOCO_EXTENDED_ALL:
+ elif converter_mode == ConverterMode.TOCO_FLEX_ALL:
toco.allow_flex_ops = True
toco.force_flex_ops = True
diff --git a/tensorflow/contrib/lite/python/lite_test.py b/tensorflow/contrib/lite/python/lite_test.py
index 7b0df01d1d..d243a494f6 100644
--- a/tensorflow/contrib/lite/python/lite_test.py
+++ b/tensorflow/contrib/lite/python/lite_test.py
@@ -412,7 +412,7 @@ class FromSessionTest(test_util.TensorFlowTestCase):
# Ensure that the quantized weights tflite model is smaller.
self.assertTrue(len(quantized_tflite) < len(float_tflite))
- def testExtendedMode(self):
+ def testFlexMode(self):
in_tensor = array_ops.placeholder(
shape=[1, 16, 16, 3], dtype=dtypes.float32)
out_tensor = in_tensor + in_tensor
@@ -421,7 +421,7 @@ class FromSessionTest(test_util.TensorFlowTestCase):
# Convert model and ensure model is not None.
converter = lite.TFLiteConverter.from_session(sess, [in_tensor],
[out_tensor])
- converter.converter_mode = lite.ConverterMode.TOCO_EXTENDED_ALL
+ converter.converter_mode = lite.ConverterMode.TOCO_FLEX_ALL
tflite_model = converter.convert()
self.assertTrue(tflite_model)
diff --git a/tensorflow/contrib/lite/testing/generate_examples.py b/tensorflow/contrib/lite/testing/generate_examples.py
index 53bd88d087..18036fac6f 100644
--- a/tensorflow/contrib/lite/testing/generate_examples.py
+++ b/tensorflow/contrib/lite/testing/generate_examples.py
@@ -81,9 +81,9 @@ parser.add_argument(
action="store_true",
help="Include intermediate graphdefs in the output zip files.")
parser.add_argument(
- "--run_with_extended",
+ "--run_with_flex",
action="store_true",
- help="Whether the TFLite Extended converter is being used.")
+ help="Whether the TFLite Flex converter is being used.")
RANDOM_SEED = 342
TEST_INPUT_DEPTH = 3
@@ -339,10 +339,10 @@ def toco_convert(graph_def_str, input_tensors, output_tensors,
graphdef_file.flush()
# TODO(aselle): Switch this to subprocess at some point.
- if "pb2lite" in bin_path and FLAGS.run_with_extended:
+ if "pb2lite" in bin_path and FLAGS.run_with_flex:
opts = ("--input_arrays={0} --output_arrays={1}".format(
",".join(input_arrays), ",".join(output_tensors)))
- elif FLAGS.run_with_extended:
+ elif FLAGS.run_with_flex:
opts += " --allow_flex_ops --force_flex_ops"
cmd = ("%s --input_file=%s --output_file=%s %s > %s 2>&1" %
(bin_path, graphdef_file.name, output_file.name, opts,
@@ -3333,7 +3333,7 @@ def main(unused_args):
# list of valid conversion modes is defined in
# generated_test_conversion_modes() in build_def.bzl.
test_function = ("make_%s_tests" % (out.replace(".zip", "").replace(
- "pb2lite", "").replace("toco-extended", "").rstrip("_")))
+ "pb2lite", "").replace("toco-flex", "").rstrip("_")))
if test_function not in globals():
raise RuntimeError("Can't find a test function to create %r. Tried %r" %
(out, test_function))
diff --git a/tensorflow/contrib/lite/testing/model_coverage/model_coverage_lib_test.py b/tensorflow/contrib/lite/testing/model_coverage/model_coverage_lib_test.py
index 5f3355e734..1498f86c6f 100644
--- a/tensorflow/contrib/lite/testing/model_coverage/model_coverage_lib_test.py
+++ b/tensorflow/contrib/lite/testing/model_coverage/model_coverage_lib_test.py
@@ -123,7 +123,7 @@ class EvaluateKerasModel(test.TestCase):
keras_file = self._saveKerasModel(model)
model_coverage.test_keras_model(
- keras_file, converter_mode=lite.ConverterMode.TOCO_EXTENDED)
+ keras_file, converter_mode=lite.ConverterMode.TOCO_FLEX)
if __name__ == '__main__':
diff --git a/tensorflow/contrib/lite/tools/benchmark/BUILD b/tensorflow/contrib/lite/tools/benchmark/BUILD
index bc18d40313..502e181139 100644
--- a/tensorflow/contrib/lite/tools/benchmark/BUILD
+++ b/tensorflow/contrib/lite/tools/benchmark/BUILD
@@ -40,7 +40,7 @@ cc_binary(
srcs = [
"benchmark_main.cc",
],
- copts = common_copts + ["-DTFLITE_EXTENDED"],
+ copts = common_copts + ["-DTFLITE_FLEX"],
linkopts = tflite_linkopts() + select({
"//tensorflow:android": [
"-pie", # Android 5.0 and later supports only PIE
@@ -117,7 +117,7 @@ cc_library(
"logging.h",
],
hdrs = ["benchmark_tflite_model.h"],
- copts = common_copts + ["-DTFLITE_EXTENDED"],
+ copts = common_copts + ["-DTFLITE_FLEX"],
deps = [
":benchmark_model_lib",
":logging",
diff --git a/tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.cc b/tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.cc
index d989ee720d..463d5993f4 100644
--- a/tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.cc
+++ b/tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.cc
@@ -23,9 +23,9 @@ limitations under the License.
#include <unordered_set>
#include <vector>
-#ifdef TFLITE_EXTENDED
+#ifdef TFLITE_FLEX
#include "tensorflow/contrib/lite/delegates/flex/delegate.h"
-#endif // TFLITE_EXTENDED
+#endif // TFLITE_FLEX
#include "tensorflow/contrib/lite/kernels/register.h"
#include "tensorflow/contrib/lite/model.h"
#include "tensorflow/contrib/lite/op_resolver.h"
@@ -305,14 +305,14 @@ void BenchmarkTfLiteModel::Init() {
interpreter->UseNNAPI(use_nnapi);
-#ifdef TFLITE_EXTENDED
+#ifdef TFLITE_FLEX
TFLITE_LOG(INFO) << "Instantiating Flex Delegate";
delegate_ = FlexDelegate::Create();
if (delegate_) {
interpreter->ModifyGraphWithDelegate(delegate_.get(),
/*allow_dynamic_tensors=*/true);
}
-#endif // TFLITE_EXTENDED
+#endif // TFLITE_FLEX
auto interpreter_inputs = interpreter->inputs();
diff --git a/tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.h b/tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.h
index 9343824b4a..b091e18a29 100644
--- a/tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.h
+++ b/tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.h
@@ -20,9 +20,9 @@ limitations under the License.
#include <string>
#include <vector>
-#ifdef TFLITE_EXTENDED
+#ifdef TFLITE_FLEX
#include "tensorflow/contrib/lite/delegates/flex/delegate.h"
-#endif // TFLITE_EXTENDED
+#endif // TFLITE_FLEX
#include "tensorflow/contrib/lite/model.h"
#include "tensorflow/contrib/lite/profiling/profile_summarizer.h"
#include "tensorflow/contrib/lite/tools/benchmark/benchmark_model.h"
@@ -73,9 +73,9 @@ class BenchmarkTfLiteModel : public BenchmarkModel {
void PrepareInputsAndOutputs() override;
private:
-#ifdef TFLITE_EXTENDED
+#ifdef TFLITE_FLEX
std::unique_ptr<FlexDelegate> delegate_;
-#endif // TFLITE_EXTENDED
+#endif // TFLITE_FLEX
std::unique_ptr<tflite::FlatBufferModel> model;
std::unique_ptr<tflite::Interpreter> interpreter;
std::vector<InputLayerInfo> inputs;