diff --git a/examples/capture_recapture/cjs.py b/examples/capture_recapture/cjs.py index 38df3a15b7..3b6539c26d 100644 --- a/examples/capture_recapture/cjs.py +++ b/examples/capture_recapture/cjs.py @@ -247,7 +247,7 @@ def main(args): sex = torch.tensor(np.genfromtxt(sex_file, delimiter=',')).float()[:, 1] print("Loaded dipper sex data.") elif args.dataset == "vole" and args.model in ["4", "5"]: - raise ValueError("Cannot run model_{} on meadow voles data, since we lack sex " + + raise ValueError("Cannot run model_{} on meadow voles data, since we lack sex " "information for these animals.".format(args.model)) else: sex = None diff --git a/examples/sparse_regression.py b/examples/sparse_regression.py index 6f3876fe19..33317d3054 100644 --- a/examples/sparse_regression.py +++ b/examples/sparse_regression.py @@ -96,6 +96,8 @@ def model(X, Y, hypers, jitter=1.0e-4): hyperparameters (eta1, xisq, ...). Compare to theorem 5.1 in reference [1]. """ + + @torch.no_grad() def compute_posterior_stats(X, Y, msq, lam, eta1, xisq, c, var_obs, jitter=1.0e-4): N, P = X.shape diff --git a/pyro/distributions/distribution.py b/pyro/distributions/distribution.py index 9cbd4a899a..cb12d929b7 100644 --- a/pyro/distributions/distribution.py +++ b/pyro/distributions/distribution.py @@ -163,7 +163,7 @@ def has_rsample_(self, value): :rtype: Distribution """ if not (value is True or value is False): - raise ValueError("Expected value in {False,True}, actual {}".format(value)) + raise ValueError("Expected value in [False,True], actual {}".format(value)) self.has_rsample = value return self diff --git a/pyro/poutine/trace_struct.py b/pyro/poutine/trace_struct.py index 4da96ce728..8596712d17 100644 --- a/pyro/poutine/trace_struct.py +++ b/pyro/poutine/trace_struct.py @@ -192,7 +192,7 @@ def log_prob_sum(self, site_filter=lambda name, site: True): except ValueError: _, exc_value, traceback = sys.exc_info() shapes = self.format_shapes(last_site=site["name"]) - raise ValueError("Error while computing log_prob_sum at site '{}':\n{}\n" + raise ValueError("Error while computing log_prob_sum at site '{}':\n{}\n{}\n" .format(name, exc_value, shapes)).with_traceback(traceback) log_p = scale_and_mask(log_p, site["scale"], site["mask"]).sum() site["log_prob_sum"] = log_p diff --git a/pyro/util.py b/pyro/util.py index 12b6013aab..cd02a6ccd9 100644 --- a/pyro/util.py +++ b/pyro/util.py @@ -295,7 +295,7 @@ def check_site_shape(site, max_plate_nesting): expected_shape = [None] * (-f.dim - len(expected_shape)) + expected_shape if expected_shape[f.dim] is not None: raise ValueError('\n '.join([ - 'at site "{}" within plate("", dim={}), dim collision'.format(site["name"], f.name, f.dim), + 'at site "{}" within plate("{}", dim={}), dim collision'.format(site["name"], f.name, f.dim), 'Try setting dim arg in other plates.'])) expected_shape[f.dim] = f.size expected_shape = [-1 if e is None else e for e in expected_shape] diff --git a/setup.py b/setup.py index 7f965ffb40..6440c2e4ce 100644 --- a/setup.py +++ b/setup.py @@ -47,7 +47,7 @@ try: long_description = open('README.md', encoding='utf-8').read() except Exception as e: - sys.stderr.write('Failed to read README.md\n'.format(e)) + sys.stderr.write('Failed to read README.md: {}\n'.format(e)) sys.stderr.flush() long_description = ''