From 579163a47ab991b39ebe95f0c7a0fc6a902a7599 Mon Sep 17 00:00:00 2001 From: RatishT <45628397+RatishT@users.noreply.github.com> Date: Thu, 21 Dec 2023 04:07:43 +0100 Subject: [PATCH] Numpy Import Convention (#3307) * Added torch.clamp inside torch.log calls Added torch.clamp in torch.log to avoid too small numbers, which would result in NaN * Added "as np" to numpy import Added "as np" to numpy import, matching standard convention and consistency in code * Fix pylint issues * Revert "Added torch.clamp inside torch.log calls" This reverts commit 87f506439bcacfb51ead6a8e55ef97db81e2eeb8. --- pyro/contrib/epidemiology/util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyro/contrib/epidemiology/util.py b/pyro/contrib/epidemiology/util.py index 5c2a29bf4b..c8eab29dfc 100644 --- a/pyro/contrib/epidemiology/util.py +++ b/pyro/contrib/epidemiology/util.py @@ -1,7 +1,7 @@ # Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 -import numpy +import numpy as np import torch import pyro @@ -168,7 +168,7 @@ def align_samples(samples, model, particle_dim): ], ] -W16 = numpy.array(W16) +W16 = np.array(W16) def compute_bin_probs(s, num_quant_bins):