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
with #1370 we changed the type of the proposal argument to accept_reject_sample to be Callable instead of torch.Distribution to enable passing a sample function directly.
However, it is not controlled whether this callable function behaves like a sample function, e.g., whether it takes a sample_shape as argument. Thus, we have to bypass the type checker here.
As a solution, I suggest defining a protocal that has a callable method with sample_shape-like input argument.
Note, this kind of approach could also apply to the way we handle potential_fns, i.e., using Python protocols instead of abstract base classes for controlling the types.
To be discussed.
The text was updated successfully, but these errors were encountered:
with #1370 we changed the type of the
proposal
argument toaccept_reject_sample
to beCallable
instead oftorch.Distribution
to enable passing asample
function directly.#1370 (comment)
However, it is not controlled whether this callable function behaves like a
sample
function, e.g., whether it takes asample_shape
as argument. Thus, we have to bypass the type checker here.As a solution, I suggest defining a protocal that has a callable method with
sample_shape
-like input argument.Note, this kind of approach could also apply to the way we handle
potential_fn
s, i.e., using Python protocols instead of abstract base classes for controlling the types.To be discussed.
The text was updated successfully, but these errors were encountered: