Skip to content

Commit

Permalink
use parent when fill! a triangular matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
harisorgn committed Jul 25, 2023
1 parent 9cd5907 commit 8133567
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function triu_mask(X::AbstractMatrix, k::Int)

# Using `similar` allows us to respect device of array, etc., e.g. `CuArray`.
m = similar(X, Bool)
return triu!(fill!(m, true), k)
return triu!(fill!(parent(m), true), k)
end

ChainRulesCore.@non_differentiable triu_mask(X::AbstractMatrix, k::Int)
Expand Down

0 comments on commit 8133567

Please sign in to comment.