Skip to content

Commit ee952df

Browse files
Update src/rulesets/LinearAlgebra/structured.jl
1 parent 9ba86d8 commit ee952df

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/rulesets/LinearAlgebra/structured.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,9 @@ function rrule(::Type{Tridiagonal}, dl, d, du)
278278
@views function ∇Tridiagonal(∂y)
279279
return (
280280
NoTangent(),
281-
diag(∂y[2:end, 1:(end - 1)]),
281+
diag(∂y, -1),
282282
diag(∂y),
283-
diag(∂y[1:(end - 1), 2:end]),
283+
diag(∂y, 1),
284284
)
285285
end
286286
return y, ∇Tridiagonal

0 commit comments

Comments
 (0)