EnzymeAD / EnzymeAD/Reactant.jl

`setindex!` doesn't update arguments inplace (optimisers.jl)

Open
#212 1 comment 0 reactions 1 assignee Claimed by @avik-pal View on GitHub
bug
Dominant language
Julia
Stars
370
Forks
74
Avg merge
18h 47m
Merged PRs (30d)
30

Description

```julia
using Optimisers, Reactant

ps = (; a = randn(10),)

ps_ra = Reactant.to_rarray(ps)
st_opt = Optimisers.setup(Optimisers.Adam(0.1), ps_ra)
gs_ra = Reactant.to_rarray((; a = randn(10),))

function run_opt!(ps, gs, st)
return last(Optimisers.update!(st, ps, gs))
end

ps_ra_copy = deepcopy(ps_ra)

run_opt!_compiled = @compile run_opt!(ps_ra, gs_ra, st_opt)
ps2 = run_opt!_compiled(ps_ra, gs_ra, st_opt)

ps_ra_copy.a .- ps2.a # Should be different
ps_ra.a .- ps2.a # Should be the same but isn't
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.