Skip to content
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

TransformedDistribution does not handle sample_shapes with >1 dimension #44

Open
feynmanliang opened this issue Feb 18, 2021 · 3 comments

Comments

@feynmanliang
Copy link
Collaborator

d, param = flowtorch.bijectors.AffineAutoregressive(
    flowtorch.params.DenseAutoregressive()
)(dist.Independent(dist.Normal(torch.zeros(3), torch.ones(3)), 1))
d.rsample((10,2)).shape

should return the same [10,2,3] shape as dist.Independent(dist.Normal(torch.zeros(3), torch.ones(3)), 1).rsample((10,2)).shape, but it currently RuntimeErrors due to mismatched shape.

@stefanwebb
Copy link
Owner

Ah apologies, these shape tests are long overdue! I'll prioritize the docs for shapes, constraints, and bijectors, and make the adjustments to the Bijector interface. Then we'll be ready to write the unit tests for shapes (and Jacobians, inverses, etc.)

@feynmanliang
Copy link
Collaborator Author

feynmanliang commented Feb 18, 2021

The behavior on log_prob's shape is also inconsistent with torch.distributions and may be due to the same RC, will open separate issue to track

@feynmanliang
Copy link
Collaborator Author

Idea for fix: take product over sample_shape and then reshape

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants