You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Occasionally it is useful to return an extra "payload" along with values and gradients. Examples include
generated quantities (eg in Stan),
simulated interim data (eg for indirect inference)
Before fixing the API for a longer time, some thought should be given to supporting this.
Here is what I am thinking of:
Define accessors get_logdensity, get_gradient, get_payload for values returned by logdensity and logdensity_and_gradient,
make the latter two return some lightweight container, which has default methods for the above,
with get_payload defaulting to nothing.
The accessors can be introduced at little cost, some dubious workarounds can make the rest non-breaking (dispatch on NTuple) but perhaps a deprecation cycle would be better.
The text was updated successfully, but these errors were encountered:
I experimented with this, and found it impractical. You can always refactor to generate interim values easily from posteriors etc. For small problems the runtime cost is trivial, but for large problems saving interim values that are not needed (eg Hamiltonian steps) would generate a ton of unnecessary allocations.
Occasionally it is useful to return an extra "payload" along with values and gradients. Examples include
Before fixing the API for a longer time, some thought should be given to supporting this.
Here is what I am thinking of:
Define accessors
get_logdensity
,get_gradient
,get_payload
for values returned bylogdensity
andlogdensity_and_gradient
,make the latter two return some lightweight container, which has default methods for the above,
with
get_payload
defaulting tonothing
.The accessors can be introduced at little cost, some dubious workarounds can make the rest non-breaking (dispatch on
NTuple
) but perhaps a deprecation cycle would be better.The text was updated successfully, but these errors were encountered: