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

Rename LocalMetaOptimizerSkipAssertionError to MetaNodeRewriterSkip

上级 0ba5c0a6
...@@ -55,9 +55,9 @@ FailureCallbackType = Callable[ ...@@ -55,9 +55,9 @@ FailureCallbackType = Callable[
] ]
class LocalMetaOptimizerSkipAssertionError(AssertionError): class MetaNodeRewriterSkip(AssertionError):
"""This is an AssertionError, but instead of having the """This is an `AssertionError`, but instead of having the
LocalMetaOptimizer print the error, it just skip that `LocalMetaOptimizer` print the error, it just skip that
compilation. compilation.
""" """
...@@ -944,7 +944,7 @@ class LocalMetaOptimizer(LocalOptimizer): ...@@ -944,7 +944,7 @@ class LocalMetaOptimizer(LocalOptimizer):
Base class for meta-optimizers that try a set of `LocalOptimizer`\s Base class for meta-optimizers that try a set of `LocalOptimizer`\s
to replace a node and choose the one that executes the fastest. to replace a node and choose the one that executes the fastest.
If the error ``LocalMetaOptimizerSkipAssertionError`` is raised during If the error `MetaNodeRewriterSkip` is raised during
compilation, we will skip that function compilation and not print compilation, we will skip that function compilation and not print
the error. the error.
...@@ -1016,7 +1016,7 @@ class LocalMetaOptimizer(LocalOptimizer): ...@@ -1016,7 +1016,7 @@ class LocalMetaOptimizer(LocalOptimizer):
) )
fn.trust_input = True fn.trust_input = True
timing = min(self.time_call(fn) for _ in range(2)) timing = min(self.time_call(fn) for _ in range(2))
except LocalMetaOptimizerSkipAssertionError: except MetaNodeRewriterSkip:
continue continue
except Exception as e: except Exception as e:
if self.verbose > 0: if self.verbose > 0:
...@@ -3052,3 +3052,28 @@ class CheckStackTraceOptimization(GlobalOptimizer): ...@@ -3052,3 +3052,28 @@ class CheckStackTraceOptimization(GlobalOptimizer):
def apply(self, fgraph): def apply(self, fgraph):
pass pass
DEPRECATED_NAMES = [
(
"LocalMetaOptimizerSkipAssertionError",
"`LocalMetaOptimizerSkipAssertionError` is deprecated: use `MetaNodeRewriterSkip` instead.",
MetaNodeRewriterSkip,
),
]
def __getattr__(name):
"""Intercept module-level attribute access of deprecated symbols.
Adapted from https://stackoverflow.com/a/55139609/3006474.
"""
from warnings import warn
for old_name, msg, old_object in DEPRECATED_NAMES:
if name == old_name:
warn(msg, DeprecationWarning, stacklevel=2)
return old_object
raise AttributeError(f"module {__name__} has no attribute {name}")
...@@ -7,7 +7,7 @@ from aesara import compile ...@@ -7,7 +7,7 @@ from aesara import compile
from aesara.compile import optdb from aesara.compile import optdb
from aesara.configdefaults import config from aesara.configdefaults import config
from aesara.graph.opt import ( from aesara.graph.opt import (
LocalMetaOptimizerSkipAssertionError, MetaNodeRewriterSkip,
TopoOptimizer, TopoOptimizer,
copy_stack_trace, copy_stack_trace,
in2out, in2out,
...@@ -583,8 +583,8 @@ def local_abstractconv_check(fgraph, node): ...@@ -583,8 +583,8 @@ def local_abstractconv_check(fgraph, node):
AbstractConv3d_gradInputs, AbstractConv3d_gradInputs,
), ),
): ):
raise LocalMetaOptimizerSkipAssertionError( raise MetaNodeRewriterSkip(
f"{node.op.__class__.__name__} Aesara optimization failed: there is no implementation " f"{node.op.__class__.__name__} Aesara rewriting failed: there is no implementation "
"available supporting the requested options. If on CPU, " "available supporting the requested options. If on CPU, "
"do you have a BLAS library installed Aesara can link against? " "do you have a BLAS library installed Aesara can link against? "
"On the CPU we do not support float16." "On the CPU we do not support float16."
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论