Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
fix: zero out shadows
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Sep 15, 2024
1 parent 4541d4f commit df2bfd5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/impl/matmul.jl
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ function EnzymeRules.augmented_primal(cfg, ::EnzymeCore.Const{typeof(matmuladd!)
!(C isa EnzymeCore.Const) ? copy(B.val) : nothing

if !(C isa EnzymeCore.DuplicatedNoNeed || C isa EnzymeCore.BatchDuplicatedNoNeed)
matmuladd!(C.val, A.val, B.val, bias.val)
matmuladd!(C.val, opmode.val, A.val, B.val, bias.val)
end

return EnzymeRules.AugmentedReturn(nothing, nothing, (A_cache, B_cache))
Expand Down
3 changes: 3 additions & 0 deletions test/common_ops/dense_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ end

(act === identity && hasbias) || continue

dweight .= 0
dx .= 0
db .= 0
Enzyme.autodiff(Reverse, matmuladd!, Duplicated(y, copy(dy)),
Duplicated(weight, dweight), Duplicated(x, dx), b_enz)

Expand Down

0 comments on commit df2bfd5

Please sign in to comment.