提交 39a455d3 authored 作者: Ricardo's avatar Ricardo 提交者: Brandon T. Willard

Remove old warning when using a dict for updates

上级 c8922630
import logging import logging
import re import re
import traceback as tb import traceback as tb
import warnings
from collections import OrderedDict
from aesara.compile.function.pfunc import pfunc from aesara.compile.function.pfunc import pfunc
from aesara.compile.function.types import orig_function from aesara.compile.function.types import orig_function
...@@ -112,7 +110,7 @@ def function( ...@@ -112,7 +110,7 @@ def function(
mode : string or `Mode` instance. mode : string or `Mode` instance.
Compilation mode. Compilation mode.
updates : iterable over pairs (shared_variable, new_expression). List, tuple updates : iterable over pairs (shared_variable, new_expression). List, tuple
or OrderedDict. or dict.
Updates the values for SharedVariable inputs according to these Updates the values for SharedVariable inputs according to these
expressions. expressions.
givens : iterable over pairs (Var1, Var2) of Variables. List, tuple or dict. givens : iterable over pairs (Var1, Var2) of Variables. List, tuple or dict.
...@@ -285,24 +283,6 @@ def function( ...@@ -285,24 +283,6 @@ def function(
if updates is None: if updates is None:
updates = [] updates = []
if (
isinstance(updates, dict)
and not isinstance(updates, OrderedDict)
and len(updates) > 1
):
warnings.warn(
"The parameter 'updates' of aesara.function()"
" expects an OrderedDict,"
" got " + str(type(updates)) + ". Using "
"a standard dictionary here results in "
"non-deterministic behavior. You should use an OrderedDict"
" if you are using Python 2.7 (collections.OrderedDict"
" for older python), or use a list of (shared, update)"
" pairs. Do not just convert your dictionary to this type before"
" the call as the conversion will still be non-deterministic.",
stacklevel=2,
)
if givens is None: if givens is None:
givens = [] givens = []
if not isinstance(inputs, (list, tuple)): if not isinstance(inputs, (list, tuple)):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论