FluxML / FluxML/Tracker.jl

Gradients dropped by `adapt`

Open
#131 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
54
Forks
37
Avg merge
5h 49m
Merged PRs (30d)
1

Description

Moving y to "gpu" inside loss causes its gradient to be lost:
```julia
julia> using Tracker, JLArrays

julia> JLArrays.allowscalar(false)

julia> Tracker.withgradient((x,y) -> sum(x[1:2] + jl(y))^2, jl([1,2,3.0]), [4,5.0])
(val = 144.0, grad = ([24.0, 24.0, 0.0], [0.0, 0.0]))

julia> ans.grad[1] isa JLArray
true
```
unlike Zygote:
```julia
julia> Zygote.withgradient((x,y) -> sum(x[1:2] + jl(y))^2, jl([1,2,3.0]), [4,5.0])
(val = 144.0, grad = ([24.0, 24.0, 0.0], [24.0, 24.0]))
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the Julia examples using Tracker.withgradient, JLArrays, and Zygote, then trace how the jl(y) value and its gradient are handled during adaptation to the GPU. Done means the Tracker example returns the nonzero gradient for y while preserving the existing x gradient behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.