4a040001aa00955b4cfb90469590bffb0b5791f8,pyro/util.py,,warn_if_nan,#Any#Any#,69
Before Change
if torch.is_tensor(value) and value.requires_grad:
value.register_hook(lambda x: warn_if_nan(x, msg))
if torch_isnan(value):
warnings.warn("Encountered NaN{}".format((": " if msg else ".") + msg), stacklevel=2)
def warn_if_inf(value, msg="", allow_posinf=False, allow_neginf=False):
After Change
also works with numbers.
if filename is None:
try:
frame = sys._getframe(1)
except ValueError:
filename = "sys"
lineno = 1
else:
filename = frame.f_code.co_filename
lineno = frame.f_lineno
if torch.is_tensor(value) and value.requires_grad:
value.register_hook(lambda x: warn_if_nan(x, "backward " + msg, filename=filename, lineno=lineno))
if torch_isnan(value):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: uber/pyro
Commit Name: 4a040001aa00955b4cfb90469590bffb0b5791f8
Time: 2020-04-16
Author: fritzo@uber.com
File Name: pyro/util.py
Class Name:
Method Name: warn_if_nan
Project Name: uber/pyro
Commit Name: 4a040001aa00955b4cfb90469590bffb0b5791f8
Time: 2020-04-16
Author: fritzo@uber.com
File Name: pyro/util.py
Class Name:
Method Name: warn_if_inf
Project Name: tensorflow/cleverhans
Commit Name: a11b365a211c9bcc1c31ee72342eeb2b3ecca23f
Time: 2019-02-08
Author: goodfellow@google.com
File Name: cleverhans/compat.py
Class Name:
Method Name: softmax_cross_entropy_with_logits