FloatTracker.jl
FloatTracker.jl copied to clipboard
Improve TrackedFloat-wrapping functions
Per discussion on RXInfer.jl#116 it would be nice to have some functions to make it easier to wrap inputs in the TrackedFloat type.
Concretely:
track(x)to traverse the arrayxand replace all floats with TFs. UseTrackedFloat64as the default but allow changes.@track foo(...)to replace all Float-like types in the function signature with TF
Is 2 needed? I'm thinking no, because TF is a subtype of the matching floats and the type alone doesn't do any converting. (foo(4.2) would be an error).
I think it'd be neat for 2 if we could hijack the original function so if it gets called with non-TrackedFloats, we wrap it and then call again.
Yes, that'd be great! Just like a Python decorator.