def __init__(self, batch_shape=(), event_shape=(), validate_args=None): self._batch_shape = batch_shape self._event_shape = event_shape if validate_args is not None: self._validate_args = validate_args if self._validate_args: for param, constraint in self.arg_constraints.items(): if is_dependent(constraint): continue # skip constraints that cannot be checked if not np.all(constraint(getattr(self, param))): raise ValueError( "The parameter {} has invalid values".format(param)) super(Distribution, self).__init__()
def __init__(self, batch_shape=(), event_shape=(), validate_args=None): self._batch_shape = batch_shape self._event_shape = event_shape if validate_args is not None: self._validate_args = validate_args if self._validate_args: for param, constraint in self.arg_constraints.items(): if param not in self.__dict__ and isinstance(getattr(type(self), param), lazy_property): continue if is_dependent(constraint): continue # skip constraints that cannot be checked is_valid = np.all(constraint(getattr(self, param))) if not_jax_tracer(is_valid): if not is_valid: raise ValueError("The parameter {} has invalid values".format(param)) super(Distribution, self).__init__()