From 519e91ddb028bcd9d7533b2572f71e86c5e3979c Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Thu, 24 Aug 2017 23:54:51 +0000 Subject: [PATCH] Add support of int8/uint8/int16/uint16 for tf.subtract This fix adds support of int8/uint8/int16/uint16 for tf.subtract (on CPU only) This fix fixes 12571. Signed-off-by: Yong Tang --- tensorflow/core/kernels/cwise_op_sub.cc | 5 ++++- tensorflow/core/ops/math_ops.cc | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tensorflow/core/kernels/cwise_op_sub.cc b/tensorflow/core/kernels/cwise_op_sub.cc index eb173c7040d..6adaecba04b 100644 --- a/tensorflow/core/kernels/cwise_op_sub.cc +++ b/tensorflow/core/kernels/cwise_op_sub.cc @@ -18,7 +18,10 @@ limitations under the License. namespace tensorflow { REGISTER7(BinaryOp, CPU, "Sub", functor::sub, float, Eigen::half, double, int32, int64, complex64, complex128); -#if defined(__ANDROID_TYPES_SLIM__) +#if !defined(__ANDROID_TYPES_SLIM__) +// Sub op for int8, uint8, int16, uint16 +REGISTER4(BinaryOp, CPU, "Sub", functor::sub, int8, uint8, int16, uint16); +#else // We only register the first type when we have multi-argument calls in the // case where we're trying to reduce executable size, but it turns out that the // int32 version of this op is needed, so explicitly include it. diff --git a/tensorflow/core/ops/math_ops.cc b/tensorflow/core/ops/math_ops.cc index 6ff05bd2a62..6eb05874aa5 100644 --- a/tensorflow/core/ops/math_ops.cc +++ b/tensorflow/core/ops/math_ops.cc @@ -499,7 +499,7 @@ Returns x + y element-wise. )doc"); REGISTER_OP("Sub") - .BINARY_FEWER() + .BINARY_MORE() .SetShapeFn(shape_inference::BroadcastBinaryOpShapeFn) .Doc(R"doc( Returns x - y element-wise.