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

Support multiple inheritance in torch.distributions #16772

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions torch/distributions/constraint_registry.py
Expand Up @@ -82,6 +82,7 @@ class ConstraintRegistry(object):
"""
def __init__(self):
self._registry = {}
super(ConstraintRegistry, self).__init__()

def register(self, constraint, factory=None):
"""
Expand Down
1 change: 1 addition & 0 deletions torch/distributions/distribution.py
Expand Up @@ -34,6 +34,7 @@ def __init__(self, batch_shape=torch.Size(), event_shape=torch.Size(), validate_
continue # skip checking lazily-constructed args
if not constraint.check(getattr(self, param)).all():
raise ValueError("The parameter {} has invalid values".format(param))
super(Distribution, self).__init__()

def expand(self, batch_shape, _instance=None):
"""
Expand Down
1 change: 1 addition & 0 deletions torch/distributions/transforms.py
Expand Up @@ -83,6 +83,7 @@ def __init__(self, cache_size=0):
self._cached_x_y = None, None
else:
raise ValueError('cache_size must be 0 or 1')
super(Transform, self).__init__()

@property
def inv(self):
Expand Down