Skip to content

Tests for @non_differentiable #202

@willtebbutt

Description

@willtebbutt

It's ocassionally not possible to test @non_differentiable using test_rrule because finite differencing gives the wrong / unreliable results.

For example, this is the case in the Vector{Floa64}(undef, 5) constructor implemented in JuliaDiff/ChainRules.jl#491 -- in this case, the values of the array produced are unreliable, so finite difference estimates of the gradient aren't consistent between different calls to the function.

One option would be to define a test_non_differentiable suite that looks something like

test_non_differentiable(f, args...; use_finite_differencing=true)

in which we prescribe a set of standard tests. In the case that the user sets use_finite_differencing=false, we could just ensure that f does indeed return NoTangents, in addition to standard things like ensuring that the primal agrees with the first output of the rrule being tested.

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