-
Notifications
You must be signed in to change notification settings - Fork 2
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
Distribution wrappers in handlers.pyro
should be deprecated in favor of defterm
#203
Comments
#214 makes some progress toward this but doesn't yet fully resolve it. I think the general solution would be a pair of operations T = TypeVar("T", bound=torch.Tensor | torch.distributions.Distribution | tree.Structure[torch.Tensor | torch.distributions.Distribution)
@defop
def bind_dims(
value: Annotated[T, Scoped[A | B]],
*names: Annotated[Operation[[], int], Scoped[B]]
) -> Annotated[T, Scoped[A]]:
...
@defop
def unbind_dims(
value: Annotated[T, Scoped[A]],
*names: Annotated[Operation[[], int], Scoped[B]]
) -> Annotated[T, Scoped[A | B]]:
...
|
Removing from the milestone since #214 is sufficient for now and the general solution would be quite a bit more effort. |
It should be possible to replace
PositionalDistribution
withdefterm
anddefdata
implementations forTorchDistribution
s. The same things would also serve as a replacement forNamedDistribution
, though we'd need an extraOperation
there since the basicDistribution
API doesn't support__getitem__
or an equivalent.The text was updated successfully, but these errors were encountered: