aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/testing
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-08-28 01:52:59 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-28 01:57:31 -0700
commit3e13ae966115b1aaf793601b0647b40efb25a2da (patch)
tree50aa649f843a698d23c99a4d6ef9c5adc6752895 /tensorflow/contrib/lite/testing
parentf255b51c6e637ac7701996b4457157d3c313dca4 (diff)
Implementation of reduce_any.
PiperOrigin-RevId: 210507220
Diffstat (limited to 'tensorflow/contrib/lite/testing')
-rw-r--r--tensorflow/contrib/lite/testing/generate_examples.py23
1 files changed, 18 insertions, 5 deletions
diff --git a/tensorflow/contrib/lite/testing/generate_examples.py b/tensorflow/contrib/lite/testing/generate_examples.py
index a329bb3a25..cbd6a2a7f0 100644
--- a/tensorflow/contrib/lite/testing/generate_examples.py
+++ b/tensorflow/contrib/lite/testing/generate_examples.py
@@ -821,13 +821,17 @@ def make_binary_op_tests(zip_path, binary_operator):
make_zip_of_tests(zip_path, test_parameters, build_graph, build_inputs)
-def make_reduce_tests(reduce_op, min_value=-10, max_value=10):
+def make_reduce_tests(reduce_op,
+ min_value=-10,
+ max_value=10,
+ boolean_tensor_only=False):
"""Make a set of tests to do reduce operation.
Args:
reduce_op: TensorFlow reduce operation to test, i.e. `tf.reduce_mean`.
min_value: min value for created tensor data.
max_value: max value for created tensor data.
+ boolean_tensor_only: If true, will only generate tensor with boolean value.
Returns:
a function representing the true generator with `reduce_op_in` curried.
@@ -867,10 +871,11 @@ def make_reduce_tests(reduce_op, min_value=-10, max_value=10):
def build_graph(parameters):
"""Build the mean op testing graph."""
+ dtype = parameters["input_dtype"]
+ if boolean_tensor_only:
+ dtype = tf.bool
input_tensor = tf.placeholder(
- dtype=parameters["input_dtype"],
- name="input",
- shape=parameters["input_shape"])
+ dtype=dtype, name="input", shape=parameters["input_shape"])
# Get axis as either a placeholder or constants.
if parameters["const_axis"]:
@@ -889,9 +894,12 @@ def make_reduce_tests(reduce_op, min_value=-10, max_value=10):
return input_tensors, [out]
def build_inputs(parameters, sess, inputs, outputs):
+ dtype = parameters["input_dtype"]
+ if boolean_tensor_only:
+ dtype = tf.bool
values = [
create_tensor_data(
- parameters["input_dtype"],
+ dtype,
parameters["input_shape"],
min_value=min_value,
max_value=max_value)
@@ -931,6 +939,11 @@ def make_reduce_min_tests(zip_path):
return make_reduce_tests(tf.reduce_min)(zip_path)
+def make_reduce_any_tests(zip_path):
+ """Make a set of tests to do any."""
+ return make_reduce_tests(tf.reduce_any, boolean_tensor_only=True)(zip_path)
+
+
def make_exp_tests(zip_path):
"""Make a set of tests to do exp."""