diff options
author | Manjunath Kudlur <keveman@gmail.com> | 2015-11-06 16:27:58 -0800 |
---|---|---|
committer | Manjunath Kudlur <keveman@gmail.com> | 2015-11-06 16:27:58 -0800 |
commit | f41959ccb2d9d4c722fe8fc3351401d53bcf4900 (patch) | |
tree | ef0ca22cb2a5ac4bdec9d080d8e0788a53ed496d /tensorflow/cc/ops/array_grad.cc |
TensorFlow: Initial commit of TensorFlow library.
TensorFlow is an open source software library for numerical computation
using data flow graphs.
Base CL: 107276108
Diffstat (limited to 'tensorflow/cc/ops/array_grad.cc')
-rw-r--r-- | tensorflow/cc/ops/array_grad.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tensorflow/cc/ops/array_grad.cc b/tensorflow/cc/ops/array_grad.cc new file mode 100644 index 0000000000..37ffed9792 --- /dev/null +++ b/tensorflow/cc/ops/array_grad.cc @@ -0,0 +1,32 @@ +#include "tensorflow/core/framework/function.h" +#include "tensorflow/core/lib/core/errors.h" + +namespace tensorflow { + +typedef FunctionDefHelper FDH; + +REGISTER_OP_NO_GRADIENT("Shape"); +REGISTER_OP_NO_GRADIENT("Rank"); +REGISTER_OP_NO_GRADIENT("Size"); + +Status ReshapeGrad(const AttrSlice& attrs, FunctionDef* g) { + // clang-format off + *g = FDH::Define( + // Arg defs + {"x: T", "shape: int32", "dy: T"}, + // Ret val defs + {"dx: T", "dshape: int32"}, + // Attr defs + {{"T: {float, double}"}}, + // Nodes + { + {{"x_shape"}, "Shape", {"x"}, {{"T", "$T"}}}, + {{"dx"}, "Reshape", {"dy", "x_shape"}, {{"T", "$T"}}}, + {{"dshape"}, "ZerosLike", {"shape"}, {{"T", DT_INT32}}}, + }); + // clang-format on + return Status::OK(); +} +REGISTER_OP_GRADIENT("Reshape", ReshapeGrad); + +} // end namespace tensorflow |