-
-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Dear ADTypes maintainers,
Thank you for your work!
This issue is just to request that the AutoEnzyme and AutoFIniteDifferences constructors be updated so that it is not necessary to have Enzyme and FiniteDifferences loaded in order to construct them.
The reason this is currently necessary, is because AutoEnzyme requires the Forward and Reverse types to specify whether Enzyme is used in forward or reverse mode, and also requires set_runtime if it is to be used with Turing (which is my use-case); similarly, AutoFiniteDifferences requires importing central_fdm from FiniteDifferences to be constructed.
There are two reasons that it would be useful to not have to load the packages themselves to use the AutoAD constructors. Firstly, it strikes me as much easier to read and use, especially by people who just want to "turn on" their choice of AD in e.g. a Turing model, if things like forward and reverse mode can just be specified with a flag or an otherwise normal keyword argument. Secondly, and more importantly, in my case I would like to use AutoEnzyme as a default argument for a function, but I cannot do that without making Enzyme a hard dependency of my package.
Since the AutoEnzyme functionality is optional, I would like to avoid making it a hard dependency, and that users should just import Enzyme to use it.
I think in Turing's case there is the same problem, but with wanting to use FiniteDifferences as default, @penelopeysm tells me.
I'll note that this works fine for other constructors, such as AutoForwardDiff (whcih is currently used as default from Turing because of this), AutoReverseDiff and AutoMooncake.
I also discussed this with Enzyme, but they said that this isn't an issue they can fix, since it is in your package.
There may also be other AutoAD constructors in your (very useful!) list that have the same limitation; I haven't checked them all, Enzyme and FiniteDifferences are just the two I ran into. My suggestion would be to make it a general policy, however, that the ADTypes constructors do not require loading the corresponding AD package in order to be constructed.
There may of course be many good reasons that I am ignorant about for why using AD package specific types and functions in your constructors is useful, or that changing it now is complicated - so forgive me if this is a stupid question.
And thank you - for the consideration and time, and again, for your work :)