提交 cec873e3 authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Remove use of logging with warnings

上级 fd8323fe
import logging import warnings
import numpy as np import numpy as np
...@@ -19,9 +19,6 @@ from aesara.tensor.type import TensorType, integer_dtypes ...@@ -19,9 +19,6 @@ from aesara.tensor.type import TensorType, integer_dtypes
from aesara.updates import OrderedUpdates from aesara.updates import OrderedUpdates
_logger = logging.getLogger("aesara.scan.basic")
def scan( def scan(
fn, fn,
sequences=None, sequences=None,
...@@ -394,7 +391,7 @@ def scan( ...@@ -394,7 +391,7 @@ def scan(
# ^ initial state but taps not provided # ^ initial state but taps not provided
if "taps" in outs_info[i]: if "taps" in outs_info[i]:
# ^ explicitly provided a None for taps # ^ explicitly provided a None for taps
_logger.warning( warnings.warn(
f"Output {getattr(outs_info[i]['initial'], 'name', 'None')} (index {i}) has a initial " f"Output {getattr(outs_info[i]['initial'], 'name', 'None')} (index {i}) has a initial "
"state but taps is explicitly set to None ", "state but taps is explicitly set to None ",
) )
...@@ -471,12 +468,12 @@ def scan( ...@@ -471,12 +468,12 @@ def scan(
if config.compute_test_value != "ignore": if config.compute_test_value != "ignore":
# No need to print a warning or raise an error now, # No need to print a warning or raise an error now,
# it will be done when fn will be called. # it will be done when fn will be called.
_logger.warning( warnings.warn(
( (
"Cannot compute test value for " "Cannot compute test value for "
"the inner function of scan, input value " "the inner function of scan, input value "
"missing {}" f"missing {_seq_val_slice}"
).format(_seq_val_slice) )
) )
# Add names to slices for debugging and pretty printing .. # Add names to slices for debugging and pretty printing ..
...@@ -600,11 +597,11 @@ def scan( ...@@ -600,11 +597,11 @@ def scan(
arg.tag.test_value = get_test_value(actual_arg) arg.tag.test_value = get_test_value(actual_arg)
except TestValueError: except TestValueError:
if config.compute_test_value != "ignore": if config.compute_test_value != "ignore":
_logger.warning( warnings.warn(
( (
"Cannot compute test value for the " "Cannot compute test value for the "
"inner function of scan, test value missing: {}" f"inner function of scan, test value missing: {actual_arg}"
).format(actual_arg) )
) )
if getattr(init_out["initial"], "name", None) is not None: if getattr(init_out["initial"], "name", None) is not None:
...@@ -658,12 +655,12 @@ def scan( ...@@ -658,12 +655,12 @@ def scan(
nw_slice.tag.test_value = get_test_value(_init_out_var_slice) nw_slice.tag.test_value = get_test_value(_init_out_var_slice)
except TestValueError: except TestValueError:
if config.compute_test_value != "ignore": if config.compute_test_value != "ignore":
_logger.warning( warnings.warn(
( (
"Cannot compute test value for " "Cannot compute test value for "
"the inner function of scan, test value " "the inner function of scan, test value "
"missing: {}" f"missing: {_init_out_var_slice}"
).format(_init_out_var_slice) )
) )
# give it a name or debugging and pretty printing # give it a name or debugging and pretty printing
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论