From 8f04d92daf29a5f5ee43a392d61baf6eef5947be Mon Sep 17 00:00:00 2001 From: Paul Donnelly Date: Fri, 21 Feb 2020 14:03:08 -0800 Subject: [PATCH] Temporary rollback of QuantizeAndDequantizeV2Grad. PiperOrigin-RevId: 296507138 Change-Id: Iab04845a3e2a760073aa3c88ef3e10272a2094c1 --- tensorflow/cc/gradients/array_grad.cc | 29 ++--- .../api_def_QuantizeAndDequantizeV2Grad.pbtxt | 8 -- .../api_def_QuantizeAndDequantizeV2Grad.pbtxt | 3 - .../api_def_QuantizeAndDequantizeV2Grad.pbtxt | 4 - .../kernels/quantize_and_dequantize_op.cc | 116 ------------------ .../core/kernels/quantize_and_dequantize_op.h | 71 ----------- .../quantize_and_dequantize_op_gpu.cu.cc | 40 ------ .../quantize_and_dequantize_op_test.cc | 48 -------- tensorflow/core/ops/array_ops.cc | 32 ----- .../eager/pywrap_gradient_exclusions.cc | 5 +- tensorflow/python/ops/array_grad.py | 5 + tensorflow/python/ops/array_ops.py | 17 --- .../api/golden/v1/tensorflow.raw_ops.pbtxt | 4 - .../api/golden/v2/tensorflow.raw_ops.pbtxt | 4 - 14 files changed, 17 insertions(+), 369 deletions(-) delete mode 100644 tensorflow/core/api_def/base_api/api_def_QuantizeAndDequantizeV2Grad.pbtxt delete mode 100644 tensorflow/core/api_def/java_api/api_def_QuantizeAndDequantizeV2Grad.pbtxt delete mode 100644 tensorflow/core/api_def/python_api/api_def_QuantizeAndDequantizeV2Grad.pbtxt diff --git a/tensorflow/cc/gradients/array_grad.cc b/tensorflow/cc/gradients/array_grad.cc index 3c0813bfe23..e9173227aad 100644 --- a/tensorflow/cc/gradients/array_grad.cc +++ b/tensorflow/cc/gradients/array_grad.cc @@ -15,12 +15,13 @@ limitations under the License. #include -#include "tensorflow/cc/framework/grad_op_registry.h" -#include "tensorflow/cc/framework/gradients.h" #include "tensorflow/cc/ops/array_ops_internal.h" #include "tensorflow/cc/ops/standard_ops.h" #include "tensorflow/core/lib/strings/strcat.h" +#include "tensorflow/cc/framework/grad_op_registry.h" +#include "tensorflow/cc/framework/gradients.h" + namespace tensorflow { namespace ops { namespace { @@ -89,25 +90,15 @@ Status QuantizeAndDequantizeGrad(const Scope& scope, const Operation& op, } REGISTER_GRADIENT_OP("QuantizeAndDequantize", QuantizeAndDequantizeGrad); -Status QuantizeAndDequantizeV2GradHelper(const Scope& scope, - const Operation& op, - const std::vector& grad_inputs, - std::vector* grad_outputs) { - Input input = Shape(scope, op.input(0)); - Input input_min = op.input(1); - Input input_max = op.input(2); - int64 axis; - TF_RETURN_IF_ERROR(GetNodeAttr(op.node()->attrs(), "axis", &axis)); - auto qdq_v2_grad = QuantizeAndDequantizeV2Grad( - scope, grad_inputs[0], input, input_min, input_max, - QuantizeAndDequantizeV2Grad::Axis(axis)); - grad_outputs->push_back(qdq_v2_grad.input_backprop); - grad_outputs->push_back(qdq_v2_grad.input_min_backprop); - grad_outputs->push_back(qdq_v2_grad.input_max_backprop); +Status QuantizeAndDequantizeV2Grad(const Scope& scope, const Operation& op, + const std::vector& grad_inputs, + std::vector* grad_outputs) { + grad_outputs->push_back(Identity(scope, grad_inputs[0])); + grad_outputs->push_back(NoGradient()); + grad_outputs->push_back(NoGradient()); return scope.status(); } -REGISTER_GRADIENT_OP("QuantizeAndDequantizeV2", - QuantizeAndDequantizeV2GradHelper); +REGISTER_GRADIENT_OP("QuantizeAndDequantizeV2", QuantizeAndDequantizeV2Grad); Status QuantizeAndDequantizeV3Grad(const Scope& scope, const Operation& op, const std::vector& grad_inputs, diff --git a/tensorflow/core/api_def/base_api/api_def_QuantizeAndDequantizeV2Grad.pbtxt b/tensorflow/core/api_def/base_api/api_def_QuantizeAndDequantizeV2Grad.pbtxt deleted file mode 100644 index 6a7a2f38897..00000000000 --- a/tensorflow/core/api_def/base_api/api_def_QuantizeAndDequantizeV2Grad.pbtxt +++ /dev/null @@ -1,8 +0,0 @@ -op { - graph_op_name: "QuantizeAndDequantizeV2Grad" - summary: "Returns the gradient of `QuantizeAndDequantizeV2`." - description: <