Skip to content

Not using "strong zeros" for deriatives of constant values #278

@MasonProtter

Description

@MasonProtter

Compare:

julia> using Diffractor, Zygote

julia> var"'"(f) = Zygote.var"'"(f);

julia> exp'(Inf)
Inf

julia> exp''(Inf)
Inf

with

julia> var"'"(f) = Diffractor.PrimeDerivativeFwd(f);

julia> exp'(Inf)
Inf

julia> exp''(Inf)
NaN

You can see in the code_typed that it appears to be subtracting 0.0 * exp(x)^2 from the answer of 1.0 * exp(x), causing the NaN. Ideally this'd instead be 1.0 * exp(x) - ZeroTangent()*exp(x)^2 so that we don't get the NaN.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions