From 63cc1189e9d4390c6a48e9d2caf45aa2d123b94b Mon Sep 17 00:00:00 2001 From: Simone Carlo Surace <51025924+simsurace@users.noreply.github.com> Date: Wed, 7 Feb 2024 14:43:54 +0100 Subject: [PATCH] Correct rule Co-authored-by: David Widmann --- src/chainrules.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chainrules.jl b/src/chainrules.jl index 321cf4f45..d9261793b 100644 --- a/src/chainrules.jl +++ b/src/chainrules.jl @@ -113,7 +113,7 @@ function ChainRulesCore.rrule(s::Sinus, x::AbstractVector, y::AbstractVector) d = x - y abs2_sind_r = (sinpi.(d) ./ s.r) .^ 2 val = sum(abs2_sind_r) - gradx = π .* cospi.(2 .* d) ./ s.r .^ 2 + gradx = π .* sinpi.(2 .* d) ./ s.r .^ 2 function evaluate_pullback(Δ::Any) r̄ = -2Δ .* abs2_sind_r ./ s.r s̄ = ChainRulesCore.Tangent{typeof(s)}(; r=r̄)