Skip to content

Improvements to rrule_test #29

@sethaxen

Description

@sethaxen

Sorry if this is a duplicate of an existing issue, but I'd like to recommend 2 improvements to rrule_test.

  1. relax the equality check of the outputs to use isapprox. Sometimes a slightly different algorithm is used to compute the output when doing AD and will cause a strict equality test to fail. e.g. the reverse-mode derivatives of eigvals(::Symmetric) uses eigen(::Symmetric), which produces approximately the same eigvals but not identical: https://github.com/FluxML/Zygote.jl/blob/0b3e32d5c0f8e5ef3b061a6f84ed5505f5a202a0/src/lib/array.jl#L590-L593
  2. If the function returns a tuple of outputs or any of the arguments are tuples, iterate over them.

I had adapted rrule_test for some Zygote functions and implemented these changes: https://gist.github.com/sethaxen/fa67e541c4a2a5e773b475349ed87fb9/677f58af483e270fc5bdc1a318825e9fef1b0256#file-zygote_power_series_tests-jl-L4-L48

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