Skip to content

Specific preparation values for DifferentiationInterfaceTest.Scenarios #771

@penelopeysm

Description

@penelopeysm

Hello @gdalle!

I was wondering if there is any way to specify the values at which the gradient preparation is carried out when constructing a Scenario. For example, this would be useful to (reproducibly) demonstrate that compiled ReverseDiff can potentially give incorrect values:

import DifferentiationInterface as DI
using ReverseDiff, ADTypes

f(x) = x[1] > 0 ? x[2] : x[2]^2

prep = DI.prepare_gradient(f, AutoReverseDiff(; compile=true), [5.0, -5.0])

DI.value_and_gradient(f, prep, AutoReverseDiff(; compile=true), [-5.0, 5.0])
# actual: (5.0, [0.0, 1.0]) - should of course be: (25.0, [0.0, 10.0])

Metadata

Metadata

Assignees

No one assigned

    Labels

    testRelated to the testing subpackage

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions