Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
MasonProtter authored Jan 24, 2024
1 parent 9972f36 commit 275b93b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/rulesets/Base/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,30 @@

function frule((_, Δ1), ::typeof(zero), x)
var"∂f/∂x" = ZeroTangent()
(zero(x), Δ1 * var"∂f/∂x")
return (zero(x), Δ1 * var"∂f/∂x")
end

function rrule(::typeof(zero), x)
Ω = zero(x)
proj_x = ProjectTo(x)
var"∂f/∂x" = ZeroTangent()
pullback(Δ1) = (NoTangent(), proj_x(conj(var"∂f/∂x") * Δ1))
(Ω, pullback)
return (Ω, pullback)
end

# `one`

function frule((_, Δ1), ::typeof(one), x)
var"∂f/∂x" = ZeroTangent()
(one(x), Δ1 * var"∂f/∂x")
return (one(x), Δ1 * var"∂f/∂x")
end

function rrule(::typeof(one), x)
Ω = one(x)
proj_x = ProjectTo(x)
var"∂f/∂x" = ZeroTangent()
pullback(Δ1) = (NoTangent(), proj_x(conj(var"∂f/∂x") * Δ1))
(Ω, pullback)
return (Ω, pullback)
end

# `adjoint`
Expand Down

0 comments on commit 275b93b

Please sign in to comment.