aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/build_def.bzl
diff options
context:
space:
mode:
authorGravatar Nupur Garg <nupurgarg@google.com>2018-09-11 16:37:49 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-09-11 16:42:08 -0700
commit8ebfc2633b355535284e6fc8970fc91dde45ed9d (patch)
tree9b5b710149f11f03c5686b38c91af888f64c1440 /tensorflow/contrib/lite/build_def.bzl
parent668c079f4e6020131978b7a812c3b92eea9c47b9 (diff)
Internal change.
PiperOrigin-RevId: 212545735
Diffstat (limited to 'tensorflow/contrib/lite/build_def.bzl')
-rw-r--r--tensorflow/contrib/lite/build_def.bzl57
1 files changed, 47 insertions, 10 deletions
diff --git a/tensorflow/contrib/lite/build_def.bzl b/tensorflow/contrib/lite/build_def.bzl
index 9317e2bb6e..0210428026 100644
--- a/tensorflow/contrib/lite/build_def.bzl
+++ b/tensorflow/contrib/lite/build_def.bzl
@@ -295,32 +295,69 @@ def generated_test_models():
"where",
]
-def gen_zip_test(name, test_name, **kwargs):
+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", ""]
+
+def generated_test_models_all():
+ """Generates a list of all tests with the different converters.
+
+ Returns:
+ List of tuples representing (conversion mode, name of test).
+ """
+ conversion_modes = generated_test_conversion_modes()
+ tests = generated_test_models()
+ options = []
+ for conversion_mode in conversion_modes:
+ for test in tests:
+ if conversion_mode:
+ test += "_%s" % conversion_mode
+ options.append((conversion_mode, test))
+ return options
+
+def gen_zip_test(name, test_name, conversion_mode, **kwargs):
"""Generate a zipped-example test and its dependent zip files.
Args:
- name: Resulting cc_test target name
- test_name: Test targets this model. Comes from the list above.
- **kwargs: tf_cc_test kwargs.
+ name: str. Resulting cc_test target name
+ test_name: str. Test targets this model. Comes from the list above.
+ conversion_mode: str. Which conversion mode to run with. Comes from the
+ list above.
+ **kwargs: tf_cc_test kwargs
"""
+ toco = "//tensorflow/contrib/lite/toco:toco"
+ flags = ""
+ if conversion_mode:
+ # 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"
+ kwargs["tags"].append("skip_already_failing")
+ kwargs["tags"].append("no_oss")
+
gen_zipped_test_file(
name = "zip_%s" % test_name,
file = "%s.zip" % test_name,
+ toco = toco,
+ flags = flags,
)
tf_cc_test(name, **kwargs)
-def gen_zipped_test_file(name, file):
+def gen_zipped_test_file(name, file, toco, flags):
"""Generate a zip file of tests by using :generate_examples.
Args:
- name: Name of output. We will produce "`file`.files" as a target.
- file: The name of one of the generated_examples targets, e.g. "transpose"
+ name: str. Name of output. We will produce "`file`.files" as a target.
+ file: str. The name of one of the generated_examples targets, e.g. "transpose"
+ toco: str. Pathname of toco binary to run
+ flags: str. Any additional flags to include
"""
- toco = "//tensorflow/contrib/lite/toco:toco"
native.genrule(
name = file + ".files",
- cmd = ("$(locations :generate_examples) --toco $(locations %s) " % toco +
- " --zip_to_output " + file + " $(@D)"),
+ cmd = (("$(locations :generate_examples) --toco $(locations {0}) " +
+ " --zip_to_output {1} {2} $(@D)").format(toco, file, flags)),
outs = [file],
tools = [
":generate_examples",