Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
18cd693a
提交
18cd693a
authored
11月 19, 2022
作者:
Brandon T. Willard
提交者:
Ricardo Vieira
11月 26, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove unnecessary graph_inputs usage in OpFromGraph
上级
556816f3
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
10 行增加
和
8 行删除
+10
-8
builders.py
pytensor/compile/builders.py
+10
-8
没有找到文件。
pytensor/compile/builders.py
浏览文件 @
18cd693a
...
@@ -344,21 +344,23 @@ class OpFromGraph(Op, HasInnerGraph):
...
@@ -344,21 +344,23 @@ class OpFromGraph(Op, HasInnerGraph):
if
isinstance
(
i
,
SharedVariable
):
if
isinstance
(
i
,
SharedVariable
):
raise
TypeError
(
f
"SharedVariables not allowed as inputs; {i}"
)
raise
TypeError
(
f
"SharedVariables not allowed as inputs; {i}"
)
for
var
in
graph_inputs
(
outputs
,
inputs
):
if
var
not
in
inputs
and
not
isinstance
(
var
,
(
Constant
,
SharedVariable
)):
raise
MissingInputError
(
f
"OpFromGraph is missing an input: {var}"
)
if
"updates"
in
kwargs
or
"givens"
in
kwargs
:
if
"updates"
in
kwargs
or
"givens"
in
kwargs
:
raise
NotImplementedError
(
"Updates and givens are not
allowed here
"
)
raise
NotImplementedError
(
"Updates and givens are not
supported
"
)
self
.
is_inline
=
inline
self
.
is_inline
=
inline
# To correctly support shared variables the inner fct should
# not see them. Otherwise there is a problem with the gradient.
self
.
shared_inputs
=
[]
self
.
shared_inputs
=
[]
for
var
in
graph_inputs
(
outputs
):
inner_graph_inputs
=
graph_inputs
(
outputs
,
inputs
)
for
var
in
inner_graph_inputs
:
if
isinstance
(
var
,
SharedVariable
):
if
isinstance
(
var
,
SharedVariable
):
# To correctly support shared variables the inner-graph should
# not see them; otherwise, there will be problems with
# gradients.
# That's why we collect the shared variables and replace them
# with dummies.
self
.
shared_inputs
.
append
(
var
)
self
.
shared_inputs
.
append
(
var
)
elif
var
not
in
inputs
and
not
isinstance
(
var
,
Constant
):
raise
MissingInputError
(
f
"OpFromGraph is missing an input: {var}"
)
inputs
,
outputs
=
replace_nominals_with_dummies
(
inputs
,
outputs
)
inputs
,
outputs
=
replace_nominals_with_dummies
(
inputs
,
outputs
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论