Skip to content

Commit b0da01f

Browse files
committed
comments from review
1 parent 9d3eadc commit b0da01f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/rulesets/LinearAlgebra/norm.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ end
2020
function rrule(::typeof(norm), x::AbstractArray, p::Real)
2121
y = LinearAlgebra.norm(x, p)
2222
function norm_pullback_p(Δy)
23-
∂x = Thunk() do
24-
return if isempty(x) || p == 0
23+
∂x = if isempty(x) || p == 0
2524
InplaceableThunk(
2625
@thunk(zero.(x) .* (zero(y) * zero(real(Δy)))),
27-
dx -> dx .= zero(eltype(dx)),
26+
identity,
2827
)
2928
elseif p == 2
3029
InplaceableThunk(
@@ -43,7 +42,6 @@ function rrule(::typeof(norm), x::AbstractArray, p::Real)
4342
else
4443
_normp_back_x(x, p, y, Δy)
4544
end
46-
end
4745
∂p = @thunk _normp_back_p(x, p, y, Δy)
4846
return (NO_FIELDS, ∂x, ∂p)
4947
end

0 commit comments

Comments
 (0)