Skip to content

Commit bafa3ba

Browse files
Apply suggestions from code review
Co-authored-by: Simeon Schaub <simeondavidschaub99@gmail.com>
1 parent 804015f commit bafa3ba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/rulesets/LinearAlgebra/norm.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ end
9595
##### `normp`
9696
#####
9797

98-
function rrule(::typeof(LinearAlgebra.normp),x::AbstractArray, p)
98+
function rrule(::typeof(LinearAlgebra.normp), x::AbstractArray, p)
9999
y = LinearAlgebra.normp(x, p)
100100
function normp_pullback(Δy)
101101
∂x = @thunk _normp_back_x(x, p, y, Δy)
@@ -110,7 +110,7 @@ function _normp_back_x(x, p, y, Δy)
110110
c = real(Δy) / y
111111
T = promote_type(eltype(x), typeof(c))
112112
∂x = similar(x, T) # same comment as _norm1_back about allocation and type-stability.
113-
∂x = broadcast!(∂x, x) do xi
113+
map!(∂x, x) do xi
114114
a = norm(xi)
115115
∂xi = xi * ((a / y)^(p - 2) * c)
116116
return ifelse(isfinite(∂xi), ∂xi, zero(∂xi))

0 commit comments

Comments
 (0)