From be5679c5e82c3d2100633d52b26bf7851b7ae28f Mon Sep 17 00:00:00 2001 From: Vassil Vassilev Date: Sun, 4 Aug 2024 07:59:56 +0000 Subject: [PATCH] Add builtin_exp --- include/clad/Differentiator/BuiltinDerivatives.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/clad/Differentiator/BuiltinDerivatives.h b/include/clad/Differentiator/BuiltinDerivatives.h index 557274a56..c7acaa0bb 100644 --- a/include/clad/Differentiator/BuiltinDerivatives.h +++ b/include/clad/Differentiator/BuiltinDerivatives.h @@ -147,6 +147,11 @@ CUDA_HOST_DEVICE inline void __builtin_powf_pullback(float x, float exponent, *d_exponent += t.pushforward * d_y; } +CUDA_HOST_DEVICE ValueAndPushforward +inline __builtin_exp_pushforward(double x, double d_x) { + return {__builtin_exp(x), __builtin_exp(x) * d_x}; +} + // FIXME: Add the rest of the __builtin_ routines for log, sqrt, abs, etc. namespace std {