Mark some comparison op quantizable in the tfl_ops

PiperOrigin-RevId: 321512821
Change-Id: Id46e4c8e12f273554661834b7eafac8dbcf54bb5
This commit is contained in:
Feng Liu 2020-07-16 00:08:59 -07:00 committed by TensorFlower Gardener
parent d2d6c3f07a
commit ff2a56b9d3
6 changed files with 34 additions and 14 deletions
tensorflow

View File

@ -1059,8 +1059,7 @@ def TFL_LessEqualOp : TFL_Op<"less_equal", [
ResultsBroadcastableShape,
BinaryOpSameElementTypeConstraint,
TFL_OperandsHaveSameShapesOrBroadcastableShape<[0, 1], 4>,
NoSideEffect,
NoQuantizableResult]> {
NoSideEffect]> {
let summary = "Less_equal operator";
let description = [{
@ -1121,8 +1120,7 @@ convolutional neural networks (NIPS 2012)](http://papers.nips.cc/paper/4824-imag
def TFL_GreaterEqualOp : TFL_Op<"greater_equal", [
TFL_OperandsHaveSameShapesOrBroadcastableShape<[0, 1], 4>,
ResultsBroadcastableShape,
NoSideEffect,
NoQuantizableResult]> {
NoSideEffect]> {
let summary = "Greater_equal operator";
let description = [{
@ -1415,7 +1413,6 @@ def TFL_EmbeddingLookupOp: TFL_Op<"embedding_lookup",
def TFL_EqualOp: TFL_Op<"equal", [
Commutative,
NoQuantizableResult,
ResultsBroadcastableShape,
TFL_OperandsHaveSameShapesOrBroadcastableShape<[0, 1], 4>,
PredOpTrait<"Operands have same value type", TCopVTEtIsSameAs<0, 1>>]> {
@ -1621,8 +1618,7 @@ def TFL_GreaterOp : TFL_Op<"greater", [
ResultsBroadcastableShape,
BinaryOpSameElementTypeConstraint,
TFL_OperandsHaveSameShapesOrBroadcastableShape<[0, 1], 4>,
NoSideEffect,
NoQuantizableResult]> {
NoSideEffect]> {
let summary = "Greater operator";
let description = [{
@ -1721,8 +1717,7 @@ def TFL_LessOp : TFL_Op<"less", [
ResultsBroadcastableShape,
BinaryOpSameElementTypeConstraint,
TFL_OperandsHaveSameShapesOrBroadcastableShape<[0, 1], 4>,
NoSideEffect,
NoQuantizableResult]> {
NoSideEffect]> {
let summary = "Less operator";
let description = [{

View File

@ -32,6 +32,11 @@ def make_equal_tests(options):
"input_shape_pair": [([], []), ([1, 1, 1, 3], [1, 1, 1, 3]),
([2, 3, 4, 5], [2, 3, 4, 5]), ([2, 3, 3], [2, 3]),
([5, 5], [1]), ([10], [2, 4, 10])],
"fully_quantize": [False],
}, {
"input_dtype": [tf.float32],
"input_shape_pair": [([1, 1, 1, 3], [1, 1, 1, 3]), ([2, 3, 3], [2, 3])],
"fully_quantize": [True],
}]
def build_graph(parameters):
@ -60,4 +65,4 @@ def make_equal_tests(options):
test_parameters,
build_graph,
build_inputs,
expected_tf_failures=4)
expected_tf_failures=5)

View File

@ -32,6 +32,11 @@ def make_greater_tests(options):
"input_shape_pair": [([1, 1, 1, 3], [1, 1, 1, 3]),
([2, 3, 4, 5], [2, 3, 4, 5]), ([2, 3, 3], [2, 3]),
([5, 5], [1]), ([10], [2, 4, 10])],
"fully_quantize": [False],
}, {
"input_dtype": [tf.float32],
"input_shape_pair": [([1, 1, 1, 3], [1, 1, 1, 3]), ([2, 3, 3], [2, 3])],
"fully_quantize": [True],
}]
def build_graph(parameters):
@ -60,4 +65,4 @@ def make_greater_tests(options):
test_parameters,
build_graph,
build_inputs,
expected_tf_failures=3)
expected_tf_failures=4)

View File

@ -32,6 +32,11 @@ def make_greater_equal_tests(options):
"input_shape_pair": [([1, 1, 1, 3], [1, 1, 1, 3]),
([2, 3, 4, 5], [2, 3, 4, 5]), ([2, 3, 3], [2, 3]),
([5, 5], [1]), ([10], [2, 4, 10])],
"fully_quantize": [False],
}, {
"input_dtype": [tf.float32],
"input_shape_pair": [([1, 1, 1, 3], [1, 1, 1, 3]), ([2, 3, 3], [2, 3])],
"fully_quantize": [True],
}]
def build_graph(parameters):
@ -60,4 +65,4 @@ def make_greater_equal_tests(options):
test_parameters,
build_graph,
build_inputs,
expected_tf_failures=3)
expected_tf_failures=4)

View File

@ -32,6 +32,11 @@ def make_less_tests(options):
"input_shape_pair": [([1, 1, 1, 3], [1, 1, 1, 3]),
([2, 3, 4, 5], [2, 3, 4, 5]), ([2, 3, 3], [2, 3]),
([5, 5], [1]), ([10], [2, 4, 10])],
"fully_quantize": [False],
}, {
"input_dtype": [tf.float32],
"input_shape_pair": [([1, 1, 1, 3], [1, 1, 1, 3]), ([2, 3, 3], [2, 3])],
"fully_quantize": [True],
}]
def build_graph(parameters):
@ -60,4 +65,4 @@ def make_less_tests(options):
test_parameters,
build_graph,
build_inputs,
expected_tf_failures=3)
expected_tf_failures=4)

View File

@ -32,6 +32,11 @@ def make_less_equal_tests(options):
"input_shape_pair": [([1, 1, 1, 3], [1, 1, 1, 3]),
([2, 3, 4, 5], [2, 3, 4, 5]), ([2, 3, 3], [2, 3]),
([5, 5], [1]), ([10], [2, 4, 10])],
"fully_quantize": [False],
}, {
"input_dtype": [tf.float32],
"input_shape_pair": [([1, 1, 1, 3], [1, 1, 1, 3]), ([2, 3, 3], [2, 3])],
"fully_quantize": [True],
}]
def build_graph(parameters):
@ -60,4 +65,4 @@ def make_less_equal_tests(options):
test_parameters,
build_graph,
build_inputs,
expected_tf_failures=3)
expected_tf_failures=4)