1/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is distributed on an "AS IS" BASIS,
11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12See the License for the specific language governing permissions and
13limitations 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
22namespace tensorflow {
23namespace ops {
24namespace {
25
26Status 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}
32REGISTER_GRADIENT_OP("ReadVariableOp", ReadVariableOpGrad);
33
34} // anonymous namespace
35} // namespace ops
36} // namespace tensorflow
37