aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/ops/math_grad.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/core/ops/math_grad.cc')
-rw-r--r--tensorflow/core/ops/math_grad.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/tensorflow/core/ops/math_grad.cc b/tensorflow/core/ops/math_grad.cc
index 9a58a31757..5e082ce8f5 100644
--- a/tensorflow/core/ops/math_grad.cc
+++ b/tensorflow/core/ops/math_grad.cc
@@ -189,6 +189,42 @@ Status TanhGrad(const AttrSlice& attrs, FunctionDef* g) {
}
REGISTER_OP_GRADIENT("Tanh", TanhGrad);
+Status AsinhGrad(const AttrSlice& attrs, FunctionDef* g) {
+ // clang-format off
+ return GradForUnaryCwise(g, {
+ {{"y"}, "Asinh", {"x"}},
+ {{"cosh"}, "Cosh", {"y"}},
+ {{"dx"}, "Mul", {"dy", "cosh"}}, // dy * cosh(y)
+ });
+ // clang-format on
+}
+REGISTER_OP_GRADIENT("Asinh", AsinhGrad);
+
+Status AcoshGrad(const AttrSlice& attrs, FunctionDef* g) {
+ // clang-format off
+ return GradForUnaryCwise(g, {
+ {{"y"}, "Acosh", {"x"}},
+ {{"sinh"}, "Sinh", {"y"}},
+ {{"dx"}, "Mul", {"dy", "sinh"}}, // dy * sinh(y)
+ });
+ // clang-format on
+}
+REGISTER_OP_GRADIENT("Acosh", AcoshGrad);
+
+Status AtanhGrad(const AttrSlice& attrs, FunctionDef* g) {
+ // clang-format off
+ return GradForUnaryCwise(g, {
+ {{"x2"}, "Square", {"x"}},
+ FDH::Const("const", 1.0f),
+ {{"one"}, "Cast", {"const"}, {{"SrcT", DT_FLOAT}, {"DstT", "$T"}}},
+ {{"a"}, "Sub", {"one", "x2"}}, // 1 - x^2
+ {{"inv"}, "Reciprocal", {"a"}},
+ {{"dx"}, "Mul", {"dy", "inv"}}
+ });
+ // clang-format on
+}
+REGISTER_OP_GRADIENT("Atanh", AtanhGrad);
+
Status SigmoidGrad(const AttrSlice& attrs, FunctionDef* g) {
// clang-format off
return GradForUnaryCwise(g, {