diff options
Diffstat (limited to 'tensorflow/core/ops/resource_variable_ops.cc')
-rw-r--r-- | tensorflow/core/ops/resource_variable_ops.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tensorflow/core/ops/resource_variable_ops.cc b/tensorflow/core/ops/resource_variable_ops.cc index 3d0a6c2157..26499540f1 100644 --- a/tensorflow/core/ops/resource_variable_ops.cc +++ b/tensorflow/core/ops/resource_variable_ops.cc @@ -14,6 +14,7 @@ // ============================================================================ #include "tensorflow/core/framework/common_shape_fns.h" +#include "tensorflow/core/framework/function.h" #include "tensorflow/core/framework/node_def_util.h" #include "tensorflow/core/framework/op.h" #include "tensorflow/core/framework/resource_mgr.h" @@ -84,6 +85,22 @@ REGISTER_OP("ReadVariableOp") .Attr("dtype: type") .SetShapeFn(ReadVariableShapeFn); +Status ReadGrad(const AttrSlice& attrs, FunctionDef* g) { + // clang-format off + *g = FunctionDefHelper::Define( + // Arg defs + {"x: resource", "dy: float"}, + // Ret val defs + {"dy: float"}, + // Attr defs + {}, + // Nodes + {}); + // clang-format on + return Status::OK(); +} +REGISTER_OP_GRADIENT("ReadVariableOp", ReadGrad); + REGISTER_OP("DestroyResourceOp") .Input("resource: resource") .Attr("ignore_lookup_error: bool = true") |