Generate testdata from original pbtxt files.

PiperOrigin-RevId: 231644215
This commit is contained in:
A. Unique TensorFlower 2019-01-30 12:19:05 -08:00 committed by TensorFlower Gardener
parent 5a1865b201
commit 1944f12a85
4 changed files with 142 additions and 8 deletions

View File

@ -4,12 +4,6 @@ package(default_visibility = ["//tensorflow:internal"])
load("//tensorflow:tensorflow.bzl", "py_test") load("//tensorflow:tensorflow.bzl", "py_test")
filegroup(
name = "interpreter_test_data",
srcs = glob(["**/testdata/*"]),
visibility = ["//tensorflow:__subpackages__"],
)
py_library( py_library(
name = "interpreter", name = "interpreter",
srcs = [ srcs = [
@ -27,7 +21,7 @@ py_library(
py_test( py_test(
name = "interpreter_test", name = "interpreter_test",
srcs = ["interpreter_test.py"], srcs = ["interpreter_test.py"],
data = [":interpreter_test_data"], data = ["//tensorflow/lite/python/testdata:interpreter_test_data"],
srcs_version = "PY2AND3", srcs_version = "PY2AND3",
tags = ["no_oss"], tags = ["no_oss"],
deps = [ deps = [

42
tensorflow/lite/python/testdata/BUILD vendored Normal file
View File

@ -0,0 +1,42 @@
licenses(["notice"]) # Apache 2.0
package(default_visibility = ["//tensorflow:internal"])
load("//tensorflow:tensorflow.bzl", "py_test")
load("//tensorflow/lite:build_def.bzl", "tf_to_tflite")
exports_files(glob(["*.pb"]))
tf_to_tflite(
name = "permute_float",
src = "permute.pbtxt",
out = "permute_float.tflite",
options = [
"--input_arrays=input",
"--output_arrays=output",
],
)
tf_to_tflite(
name = "permute_uint8",
src = "permute.pbtxt",
out = "permute_uint8.tflite",
options = [
"--input_arrays=input",
"--output_arrays=output",
"--inference_type=QUANTIZED_UINT8",
"--std_values=1",
"--mean_values=0",
"--default_ranges_min=0",
"--default_ranges_max=255",
],
)
filegroup(
name = "interpreter_test_data",
srcs = [
":permute_float",
":permute_uint8",
],
visibility = ["//tensorflow:__subpackages__"],
)

View File

@ -0,0 +1,98 @@
node {
name: "input"
op: "Placeholder"
device: "/device:CPU:0"
attr {
key: "dtype"
value {
type: DT_FLOAT
}
}
attr {
key: "shape"
value {
shape {
dim {
size: 1
}
dim {
size: 4
}
}
}
}
}
node {
name: "Const"
op: "Const"
device: "/device:CPU:0"
attr {
key: "dtype"
value {
type: DT_FLOAT
}
}
attr {
key: "value"
value {
tensor {
dtype: DT_FLOAT
tensor_shape {
dim {
size: 4
}
dim {
size: 4
}
}
float_val: 0.0
float_val: 0.0
float_val: 0.0
float_val: 1.0
float_val: 0.0
float_val: 0.0
float_val: 1.0
float_val: 0.0
float_val: 0.0
float_val: 1.0
float_val: 0.0
float_val: 0.0
float_val: 1.0
float_val: 0.0
float_val: 0.0
float_val: 0.0
}
}
}
}
node {
name: "output"
op: "MatMul"
input: "input"
input: "Const"
device: "/device:CPU:0"
attr {
key: "T"
value {
type: DT_FLOAT
}
}
attr {
key: "transpose_a"
value {
b: false
}
}
attr {
key: "transpose_b"
value {
b: false
}
}
}
versions {
producer: 27
}

View File

@ -59,7 +59,7 @@ COMMON_PIP_DEPS = [
"setup.py", "setup.py",
":included_headers", ":included_headers",
"//tensorflow:tensorflow_py", "//tensorflow:tensorflow_py",
"//tensorflow/lite/python:interpreter_test_data", "//tensorflow/lite/python/testdata:interpreter_test_data",
"//tensorflow/lite/python:tflite_convert", "//tensorflow/lite/python:tflite_convert",
"//tensorflow/lite/toco/python:toco_from_protos", "//tensorflow/lite/toco/python:toco_from_protos",
# "//tensorflow/python/autograph/converters:converters", # "//tensorflow/python/autograph/converters:converters",