Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
avik-pal opened this issue Nov 1, 2024 · 1 comment
Open

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

avik-pal opened this issue Nov 1, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@avik-pal
Copy link
Collaborator

avik-pal commented Nov 1, 2024

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
@avik-pal avik-pal added the bug Something isn't working label Nov 1, 2024
@wsmoses
Copy link
Member

wsmoses commented Nov 3, 2024

@avik-pal can you dive into this one?

@avik-pal avik-pal self-assigned this Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants