FluxML / FluxML/Tracker.jl

Nested derivatives do not work for functions with arrays as argument

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

Description

See the following code.
Pseudocode + explanations:
```
f = x1 * x2
grad_f = (x2, x1)
fg = sum(grad_f) = x2+x1
grad_fg = [1, 1]
```

Actual code:
```
using Tracker

x = param([1, 2]) # Tracked 3-element Vector{Float64}
f(x) = prod(x)
g(x) = gradient(f, x, nest=true)
fg(x) = sum(g(x)[1])
gg = gradient(fg, x)
```
The value of `gg` is `[-2.0, -0.5]` instead of `[1, 1]`

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.