Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
88d68ac4
提交
88d68ac4
authored
5月 07, 2022
作者:
Brandon T. Willard
提交者:
Brandon T. Willard
5月 08, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove mentions of unimplemented reoptimize_unpickled_function option
上级
c8de0d44
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
0 行增加
和
90 行删除
+0
-90
configdefaults.py
aesara/configdefaults.py
+0
-7
faq.rst
doc/faq.rst
+0
-9
config.rst
doc/library/config.rst
+0
-6
test_function.py
tests/compile/function/test_function.py
+0
-68
没有找到文件。
aesara/configdefaults.py
浏览文件 @
88d68ac4
...
...
@@ -378,13 +378,6 @@ def add_basic_configvars():
in_c_key
=
False
,
)
config
.
add
(
"reoptimize_unpickled_function"
,
"Re-optimize the graph when an Aesara function is unpickled from the disk."
,
BoolParam
(
False
,
mutable
=
True
),
in_c_key
=
False
,
)
def
_is_gt_0
(
x
):
return
x
>
0
...
...
doc/faq.rst
浏览文件 @
88d68ac4
...
...
@@ -72,15 +72,6 @@ detection algorithm. If the graph is big enough,we suggest that you use
this flag instead of ``optimizer_excluding=inplace``. It will result in a
computation time that is in between fast compile and fast run.
Aesara flag `reoptimize_unpickled_function` controls if an unpickled
aesara function should reoptimize its graph or not. Aesara users can
use the standard python pickle tools to save a compiled aesara
function. When pickling, both graph before and after the optimization
are saved, including shared variables. When set to True, the graph is
reoptimized when being unpickled. Otherwise, skip the graph
optimization and use directly the optimized graph from the pickled
file. The default is False.
Faster Aesara function
----------------------
...
...
doc/library/config.rst
浏览文件 @
88d68ac4
...
...
@@ -820,12 +820,6 @@ import ``aesara`` and print the config variable, as in:
If ``'True'``, Aesara will include the test values in a variable's
``__str__`` output.
.. attribute:: reoptimize_unpickled_function
Bool value, default: False
When this option is set to ``True``, a graph is re-optimized when unpickled.
.. attribute:: exception_verbosity
String Value: ``'low'``, ``'high'``.
...
...
tests/compile/function/test_function.py
浏览文件 @
88d68ac4
...
...
@@ -3,7 +3,6 @@ import pickle
import
re
import
shutil
import
tempfile
from
collections
import
OrderedDict
import
numpy
as
np
import
pytest
...
...
@@ -12,13 +11,11 @@ from aesara.compile import shared
from
aesara.compile.function
import
function
,
function_dump
from
aesara.compile.io
import
In
from
aesara.configdefaults
import
config
from
aesara.tensor.math
import
sum
as
at_sum
from
aesara.tensor.type
import
(
bscalar
,
bvector
,
dscalar
,
dvector
,
fmatrix
,
fscalar
,
fvector
,
vector
,
...
...
@@ -236,68 +233,3 @@ class TestFunctionIn:
# If allow_downcast is None, like False
with
pytest
.
raises
(
TypeError
):
f
(
z
,
z
,
[
0.1
])
def
test_pickle_unpickle_with_reoptimization
():
mode
=
config
.
mode
if
mode
in
[
"DEBUG_MODE"
,
"DebugMode"
]:
mode
=
"FAST_RUN"
x1
=
fmatrix
(
"x1"
)
x2
=
fmatrix
(
"x2"
)
x3
=
shared
(
np
.
ones
((
10
,
10
),
dtype
=
floatX
))
x4
=
shared
(
np
.
ones
((
10
,
10
),
dtype
=
floatX
))
y
=
at_sum
(
at_sum
(
at_sum
(
x1
**
2
+
x2
)
+
x3
)
+
x4
)
updates
=
OrderedDict
()
updates
[
x3
]
=
x3
+
1
updates
[
x4
]
=
x4
+
1
f
=
function
([
x1
,
x2
],
y
,
updates
=
updates
,
mode
=
mode
)
# now pickle the compiled aesara fn
string_pkl
=
pickle
.
dumps
(
f
,
-
1
)
in1
=
np
.
ones
((
10
,
10
),
dtype
=
floatX
)
in2
=
np
.
ones
((
10
,
10
),
dtype
=
floatX
)
# test unpickle with optimization
default
=
config
.
reoptimize_unpickled_function
try
:
# the default is True
config
.
reoptimize_unpickled_function
=
True
f_
=
pickle
.
loads
(
string_pkl
)
assert
f
(
in1
,
in2
)
==
f_
(
in1
,
in2
)
finally
:
config
.
reoptimize_unpickled_function
=
default
def
test_pickle_unpickle_without_reoptimization
():
mode
=
config
.
mode
if
mode
in
[
"DEBUG_MODE"
,
"DebugMode"
]:
mode
=
"FAST_RUN"
x1
=
fmatrix
(
"x1"
)
x2
=
fmatrix
(
"x2"
)
x3
=
shared
(
np
.
ones
((
10
,
10
),
dtype
=
floatX
))
x4
=
shared
(
np
.
ones
((
10
,
10
),
dtype
=
floatX
))
y
=
at_sum
(
at_sum
(
at_sum
(
x1
**
2
+
x2
)
+
x3
)
+
x4
)
updates
=
OrderedDict
()
updates
[
x3
]
=
x3
+
1
updates
[
x4
]
=
x4
+
1
f
=
function
([
x1
,
x2
],
y
,
updates
=
updates
,
mode
=
mode
)
# now pickle the compiled aesara fn
string_pkl
=
pickle
.
dumps
(
f
,
-
1
)
# compute f value
in1
=
np
.
ones
((
10
,
10
),
dtype
=
floatX
)
in2
=
np
.
ones
((
10
,
10
),
dtype
=
floatX
)
# test unpickle without optimization
default
=
config
.
reoptimize_unpickled_function
try
:
# the default is True
config
.
reoptimize_unpickled_function
=
False
f_
=
pickle
.
loads
(
string_pkl
)
assert
f
(
in1
,
in2
)
==
f_
(
in1
,
in2
)
finally
:
config
.
reoptimize_unpickled_function
=
default
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论