Skip to content

Commit 17a5673

Browse files
authored
broadcast adjoint for unary minus (#1287)
1 parent e4fc02c commit 17a5673

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/lib/broadcast.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ unbroadcast(x::AbstractArray, x̄::Nothing) = nothing
8080

8181
@adjoint broadcasted(::typeof(-), x::Numeric, y::Numeric) = x .- y,
8282
Δ -> (nothing, unbroadcast(x, Δ), _minus(unbroadcast(y, Δ)))
83+
@adjoint broadcasted(::typeof(-), x::Numeric) = .-x,
84+
Δ -> (nothing, _minus(Δ))
8385
_minus(Δ) = -Δ
8486
_minus(::Nothing) = nothing
8587

0 commit comments

Comments
 (0)