ChainRulesTestUtils.jl icon indicating copy to clipboard operation
ChainRulesTestUtils.jl copied to clipboard

Test functions with constraints on arguments

Open devmotion opened this issue 4 years ago • 1 comments

Related to https://github.com/JuliaDiff/FiniteDifferences.jl/issues/52, it seems there is currently no way to specify constraints on function arguments to FiniteDifferences. For instance, when testing the ChainRule adjoint of (an extension of) binomlogpdf(n, p, x) input p has to be constrained to the interval [0, 1] since otherwise the forward pass errors.

devmotion avatar Jan 02 '21 12:01 devmotion

In DistributionsAD we introduced a custom way to specify mappings from R^n to the desired subspace to avoid these issues in our tests (see, e.g., https://github.com/TuringLang/DistributionsAD.jl/blob/d5a479acc90acd9fe42f1abd207788c164ac85af/test/ad/distributions.jl#L252)

devmotion avatar Jan 02 '21 12:01 devmotion