Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
10bb77bf
提交
10bb77bf
authored
12月 16, 2021
作者:
Brandon T. Willard
提交者:
Brandon T. Willard
12月 22, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix type exceptions
上级
9b787864
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
12 行增加
和
15 行删除
+12
-15
types.py
aesara/compile/function/types.py
+12
-15
没有找到文件。
aesara/compile/function/types.py
浏览文件 @
10bb77bf
...
@@ -64,7 +64,7 @@ def alias_root(v):
...
@@ -64,7 +64,7 @@ def alias_root(v):
v_views
=
vmap
.
get
(
outpos
,
[])
+
dmap
.
get
(
outpos
,
[])
v_views
=
vmap
.
get
(
outpos
,
[])
+
dmap
.
get
(
outpos
,
[])
if
len
(
v_views
)
>
1
:
if
len
(
v_views
)
>
1
:
raise
NotImplementedError
(
raise
NotImplementedError
(
str
(
v
)
+
"
is a view/destroyed version of more then one inputs. "
f
"{v}
is a view/destroyed version of more then one inputs. "
"Currently, we only support the case where an output is a view or "
"Currently, we only support the case where an output is a view or "
"a destroyed version of one input."
"a destroyed version of one input."
)
)
...
@@ -192,9 +192,7 @@ def std_fgraph(input_specs, output_specs, accept_inplace=False):
...
@@ -192,9 +192,7 @@ def std_fgraph(input_specs, output_specs, accept_inplace=False):
for
node
in
fgraph
.
apply_nodes
:
for
node
in
fgraph
.
apply_nodes
:
if
node
.
op
.
destroy_map
:
if
node
.
op
.
destroy_map
:
if
not
accept_inplace
:
if
not
accept_inplace
:
raise
TypeError
(
raise
TypeError
(
f
"Graph must not contain inplace operations: {node}"
)
"Graph must not contain inplace operations"
,
node
,
node
.
op
)
else
:
else
:
fgraph
.
attach_feature
(
DestroyHandler
())
fgraph
.
attach_feature
(
DestroyHandler
())
break
break
...
@@ -1333,7 +1331,9 @@ class FunctionMaker:
...
@@ -1333,7 +1331,9 @@ class FunctionMaker:
if
len
(
input
)
==
2
:
if
len
(
input
)
==
2
:
return
SymbolicInput
(
input
[
0
],
update
=
input
[
1
])
return
SymbolicInput
(
input
[
0
],
update
=
input
[
1
])
else
:
else
:
raise
TypeError
(
"Expected two elements in the list or tuple."
,
input
)
raise
TypeError
(
f
"Expected two elements in the list or tuple; got {input}"
)
else
:
else
:
raise
TypeError
(
raise
TypeError
(
f
"Unknown input type: {type(input)} ({input}), expected Variable "
f
"Unknown input type: {type(input)} ({input}), expected Variable "
...
@@ -1748,10 +1748,9 @@ class FunctionMaker:
...
@@ -1748,10 +1748,9 @@ class FunctionMaker:
raise
UnusedInputError
(
msg
%
(
inputs
.
index
(
i
),
i
.
variable
,
err_msg
))
raise
UnusedInputError
(
msg
%
(
inputs
.
index
(
i
),
i
.
variable
,
err_msg
))
else
:
else
:
raise
ValueError
(
raise
ValueError
(
"Invalid value for keyword "
"Invalid value for keyword on_unused_input of aesara.function: "
"on_unused_input of aesara.function: "
f
"'{on_unused_input}'.
\n
"
"'
%
s'.
\n
Valid values are 'raise', "
"Valid values are 'raise', 'warn', and 'ignore'."
"'warn', and 'ignore'."
%
on_unused_input
)
)
def
create
(
self
,
input_storage
=
None
,
trustme
=
False
,
storage_map
=
None
):
def
create
(
self
,
input_storage
=
None
,
trustme
=
False
,
storage_map
=
None
):
...
@@ -2016,7 +2015,7 @@ def convert_function_input(input):
...
@@ -2016,7 +2015,7 @@ def convert_function_input(input):
if
isinstance
(
input
,
SymbolicInput
):
if
isinstance
(
input
,
SymbolicInput
):
return
input
return
input
elif
isinstance
(
input
,
Constant
):
elif
isinstance
(
input
,
Constant
):
raise
TypeError
(
"A Constant instance is not a legal function input"
,
input
)
raise
TypeError
(
f
"A Constant instance is not a legal function input: {input}"
)
elif
isinstance
(
input
,
Variable
):
elif
isinstance
(
input
,
Variable
):
return
In
(
input
)
return
In
(
input
)
elif
isinstance
(
input
,
(
list
,
tuple
)):
elif
isinstance
(
input
,
(
list
,
tuple
)):
...
@@ -2059,13 +2058,11 @@ def convert_function_input(input):
...
@@ -2059,13 +2058,11 @@ def convert_function_input(input):
if
not
isinstance
(
variable
,
Variable
):
if
not
isinstance
(
variable
,
Variable
):
raise
TypeError
(
raise
TypeError
(
f
"Unknown input type: {type(variable)}, expected Variable instance"
,
f
"Unknown input type: {type(variable)}, expected Variable instance"
variable
,
)
)
if
update
is
not
None
and
not
isinstance
(
update
,
Variable
):
if
update
is
not
None
and
not
isinstance
(
update
,
Variable
):
raise
TypeError
(
raise
TypeError
(
f
"Unknown update type: {type(update)}, expected Variable instance"
,
f
"Unknown update type: {type(update)}, expected Variable instance"
update
,
)
)
if
value
is
not
None
and
isinstance
(
value
,
(
Variable
,
SymbolicInput
)):
if
value
is
not
None
and
isinstance
(
value
,
(
Variable
,
SymbolicInput
)):
raise
TypeError
(
raise
TypeError
(
...
@@ -2076,7 +2073,7 @@ def convert_function_input(input):
...
@@ -2076,7 +2073,7 @@ def convert_function_input(input):
return
In
(
variable
,
name
=
name
,
value
=
value
,
update
=
update
)
return
In
(
variable
,
name
=
name
,
value
=
value
,
update
=
update
)
else
:
else
:
raise
TypeError
(
raise
TypeError
(
f
"Unknown input type: {type(input)}, expected Variable instance"
,
input
f
"Unknown input type: {type(input)}, expected Variable instance"
)
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论