Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test frules with NotImplemented properly #222

Open
devmotion opened this issue Oct 3, 2021 · 0 comments
Open

Test frules with NotImplemented properly #222

devmotion opened this issue Oct 3, 2021 · 0 comments

Comments

@devmotion
Copy link
Member

devmotion commented Oct 3, 2021

Currently, test_frule is pretty useless if one of the partial derivatives is a NotImplemented since the derivative will always be a NotImplemented and hence tests always pass (even though marked as broken), regardless of the other derivatives. With JuliaDiff/ChainRulesCore.jl#477 it is possible to test the other partial derivatives by setting the tangents of the arguments for which the partial derivative is a NotImplemented to NoTangent() to test these partial derivatives properly. However, currently one has to do this manually, as in https://github.com/JuliaMath/SpecialFunctions.jl/blob/0af956882245e3b07340002c7c95c319e51af52a/test/chainrules.jl#L56-L57. It would be nice if these proper tests would be performed automatically.

Since it can't be inferred automatically which argument caused the NotImplemented derivative one approach might be to force users to always specify a NoTangent() tangent in the frule tests if the partial derivative is NotImplemented (if this is not already the default rand_tangent, in which case the partial derivative probably should just be NoTangent()), and basically not allow NotImplemented derivatives in the tests. A problem might be that this hides the fact that the implementation is broken and should be fixed in the frule tests. Maybe it would be better to let users specify a tangent of type NotImplemented (e.g. with @not_implemented()) and then use a NoTangent() internally but mark the tests as broken?

Originally posted by @devmotion in JuliaDiff/ChainRulesCore.jl#477 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant