FluxML / FluxML/Tracker.jl

Incorrect hessian returned for `prod`

Open
#120 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

The `(i,j)`th element of the Hessian of `y=prod(x)` is `y/x[i]/x[j]` for `i ≠ j` and 0 for `i==j`, i.e. its diagonal is zero. However,

```julia
julia> x = randn(3)
3-element Vector{Float64}:
0.11546090256645888
2.4121509171945448
-1.6103562544798857

julia> Tracker.hessian(prod, x)
Tracked 3×3 Matrix{Float64}:
33.6428 0.0 0.0
0.0 0.0770819 0.0
0.0 0.0 0.172949
```
I believe this stems from the custom rule Tracker uses for `prod`.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with `Tracker.hessian(prod, x)` using the Julia example, then inspect the custom rule Tracker uses for `prod`. Done means the returned Hessian has zero diagonal entries and the expected off-diagonal values for the product.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.