Skip to content

accumulate gradient with the new gradient API? #707

Closed
FluxML/Zygote.jl
#902
@chengchingwen

Description

@chengchingwen

I want to accumulate the gradient value of multiple data before I do back-prop. In the old API, I can just run multiple times of back!(loss) then call the udpate!(opt, params(model)). However, with the new gradient API, I have to collect all the Grad(...) beforehand and then call multiple times of update!(opt, params(model)), grad). Are there any better ways to do this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions