Skip to content

Repeted evaluation of fx0 when computing forward differences for gradients #202

@junyuan-chen

Description

@junyuan-chen

For f that maps a vector of length N to a scalar, I am expecting f to be evaluated for only N+1 times with fdtype == Val(:forward). What actually happens is that the same fx0 = f(x) is evaluated for N times as iterating across all elements of the input vector. Hence, f is called 2N times!

See the line below that should be pulled out of the loop:

fx0 = f(x)

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