1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. |
---|---|
2 | |
3 | Licensed under the Apache License, Version 2.0 (the "License"); |
4 | you may not use this file except in compliance with the License. |
5 | You may obtain a copy of the License at |
6 | |
7 | http://www.apache.org/licenses/LICENSE-2.0 |
8 | |
9 | Unless required by applicable law or agreed to in writing, software |
10 | distributed under the License is distributed on an "AS IS" BASIS, |
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | See the License for the specific language governing permissions and |
13 | limitations under the License. |
14 | ==============================================================================*/ |
15 | |
16 | #include <vector> |
17 | |
18 | #include "tensorflow/cc/framework/grad_op_registry.h" |
19 | #include "tensorflow/cc/framework/gradients.h" |
20 | #include "tensorflow/cc/ops/array_ops.h" |
21 | |
22 | namespace tensorflow { |
23 | namespace ops { |
24 | namespace { |
25 | |
26 | Status ReadVariableOpGrad(const Scope& scope, const Operation& op, |
27 | const std::vector<Output>& grad_inputs, |
28 | std::vector<Output>* grad_outputs) { |
29 | grad_outputs->push_back(Identity(scope, grad_inputs[0])); |
30 | return scope.status(); |
31 | } |
32 | REGISTER_GRADIENT_OP("ReadVariableOp", ReadVariableOpGrad); |
33 | |
34 | } // anonymous namespace |
35 | } // namespace ops |
36 | } // namespace tensorflow |
37 |