Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
7d6dfcb4
提交
7d6dfcb4
authored
2月 16, 2022
作者:
Brandon T. Willard
提交者:
Brandon T. Willard
2月 22, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix comments and add some type annotations to aesara.compile.function.pfunc
上级
e588b752
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
9 行增加
和
16 行删除
+9
-16
pfunc.py
aesara/compile/function/pfunc.py
+9
-16
没有找到文件。
aesara/compile/function/pfunc.py
浏览文件 @
7d6dfcb4
...
...
@@ -5,7 +5,7 @@ Provide a simple user friendly API.
import
logging
from
aesara.compile.function.types
import
UnusedInputError
,
orig_function
from
aesara.compile.function.types
import
Function
,
UnusedInputError
,
orig_function
from
aesara.compile.io
import
In
,
Out
from
aesara.compile.profiling
import
ProfileStats
from
aesara.compile.sharedvalue
import
SharedVariable
,
shared
...
...
@@ -27,8 +27,7 @@ def rebuild_collect_shared(
copy_inputs_over
=
True
,
no_default_updates
=
False
,
):
"""
Function that allows replacing subgraphs of a computational graph.
"""Replace subgraphs of a computational graph.
It returns a set of dictionaries and lists which collect (partial?)
different information about shared variables. This info is required by
...
...
@@ -280,7 +279,7 @@ def pfunc(
profile
=
None
,
on_unused_input
=
None
,
output_keys
=
None
,
):
)
->
Function
:
"""
Function-constructor for graphs with shared variables.
...
...
@@ -328,33 +327,27 @@ def pfunc(
Returns
-------
aesara.compile.Function
A callable object that will compute the outputs (given the inputs) and
update the implicit function arguments according to the `updates`.
A callable object that will compute the outputs (given the inputs) and
update the implicit function arguments according to the `updates`.
Notes
-----
Regarding givens: Be careful to make sure that these substitutions are
independent--behaviour when
Var1
of one pair appears in the graph leading
to
Var2
in another expression is undefined. Replacements specified with
givens are different from optimizations in that
Var2 is not expected to be
equivalent to Var1
.
independent--behaviour when
``Var1``
of one pair appears in the graph leading
to
``Var2``
in another expression is undefined. Replacements specified with
givens are different from optimizations in that
``Var2`` is not expected to
be equivalent to ``Var1``
.
"""
if
profile
is
None
:
profile
=
config
.
profile
or
config
.
print_global_stats
# profile -> True or False
if
profile
is
False
:
profile
=
None
if
profile
is
True
:
profile
=
ProfileStats
(
message
=
name
)
# profile -> object
elif
isinstance
(
profile
,
str
):
profile
=
ProfileStats
(
message
=
profile
)
# profile is typically either False or an object at this point.
# No need to block other objects being passed through though. It might be
# useful.
inputs
,
cloned_outputs
=
construct_pfunc_ins_and_outs
(
params
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论