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

fix loc scale reparam with center=1 #1059

Merged
merged 1 commit into from
Jun 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion numpyro/infer/reparam.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __call__(self, name, fn, obs):
assert obs is None, "LocScaleReparam does not support observe statements"
centered = self.centered
if is_identically_one(centered):
return name, fn, obs
return fn, obs
event_shape = fn.event_shape
fn, expand_shape, event_dim = self._unwrap(fn)

Expand Down
4 changes: 2 additions & 2 deletions test/infer/test_reparam.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ def get_expected_probe(loc, scale):
return get_moments(trace["x"]["value"])

if "dist_type" == "Normal":
reparam = LocScaleReparam()
reparam = LocScaleReparam(centered)
else:
reparam = LocScaleReparam(shape_params=["df"])
reparam = LocScaleReparam(centered, shape_params=["df"])

def get_actual_probe(loc, scale):
with numpyro.handlers.trace() as trace:
Expand Down