Skip to content

Absstep is not respected in AutoFiniteDiff #811

@1-Bart-1

Description

@1-Bart-1

When using the backend = AutoFiniteDiff(absstep=100, relstep=0.01) one would expect the state to be perturbed with a value of max(100.0, 0.01*x), but this doesn't actually happen. It looks like relstep is set to be equal to absstep somewhere.

julia> backend = AutoFiniteDiff(absstep=100, relstep=0.01)
AutoFiniteDiff(relstep=0.01, absstep=100, )

julia> x = collect(1.0:5.0)
5-element Vector{Float64}:
 1.0
 2.0
 3.0
 4.0
 5.0

julia> function f(x)
           println(x)
           sum(abs2, x)
       end
f (generic function with 1 method)

julia> gradient(f, backend, x)
[1.0, 2.0, 3.0, 4.0, 5.0]
[1.0, 2.0, 3.0, 4.0, 5.0]
[1.01, 2.0, 3.0, 4.0, 5.0]
[1.0, 2.0, 3.0, 4.0, 5.0]
[1.0, 2.02, 3.0, 4.0, 5.0]
[1.0, 2.0, 3.0, 4.0, 5.0]
[1.0, 2.0, 3.03, 4.0, 5.0]
[1.0, 2.0, 3.0, 4.0, 5.0]
[1.0, 2.0, 3.0, 4.04, 5.0]
[1.0, 2.0, 3.0, 4.0, 5.0]
[1.0, 2.0, 3.0, 4.0, 5.05]
5-element Vector{Float64}:
  2.009999999999934
  4.019999999999868
  6.030000000000039
  8.040000000000092
 10.049999999999955

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