Skip to content

Incorrect hessian returned for prod #120

Open
@sethaxen

Description

@sethaxen

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> 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions