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: <