Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b852f695
提交
b852f695
authored
11月 02, 2011
作者:
nouiz
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #180 from pascanur/better_error_msg
Made error message more explicit
上级
61168784
fb605c1c
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
20 行增加
和
9 行删除
+20
-9
scan_op.py
theano/scan_module/scan_op.py
+20
-9
没有找到文件。
theano/scan_module/scan_op.py
浏览文件 @
b852f695
...
...
@@ -154,12 +154,22 @@ class Scan(PureOp):
def
make_node
(
self
,
*
inputs
):
assert
numpy
.
all
(
isinstance
(
i
,
gof
.
Variable
)
for
i
in
inputs
)
# assert dtype is consistent
err_msg1
=
(
'
%
s
%
s (index
%
d) has dtype
%
s. Slice
%
s representing '
'this input has dtype
%
s'
)
err_msg2
=
(
'Initial state
%
s (index
%
d) has dtype
%
s. The '
'corresponding output of the inner function applied '
'recurrently has dtype
%
s'
)
err_msg1
=
(
'When compiling the inner function of scan the '
'following error has been encountered: The '
'
%
s
%
s( the entry number
%
d) has dtype '
'
%
s. The corresponding slice
%
s however has'
' dtype
%
s. This should never happen, please '
'report to theano-dev mailing list'
)
err_msg2
=
(
'When compiling the inner function of scan the '
'following error has been encountered: The '
'initial state (outputs_info in scan nomenclature)'
'of variable
%
s (the entry number
%
d)'
' has dtype
%
s, while the result of the'
' inner function for this output has dtype
%
s. This '
'could happen if the inner graph of scan results in '
'an upcast or downcast. Please make sure that you use'
'dtypes consistently'
)
# Flags that indicate which inputs are vectors
...
...
@@ -174,7 +184,7 @@ class Scan(PureOp):
# them have the same dtype
for
idx
in
xrange
(
self
.
n_seqs
):
if
inputs
[
1
+
idx
]
.
dtype
!=
self
.
inputs
[
idx
]
.
dtype
:
raise
ValueError
(
err_msg1
%
(
'
S
equence'
raise
ValueError
(
err_msg1
%
(
'
s
equence'
,
str
(
inputs
[
1
+
idx
])
,
idx
,
inputs
[
1
+
idx
]
.
dtype
...
...
@@ -194,7 +204,8 @@ class Scan(PureOp):
while
index
<
end
:
for
k
in
self
.
tap_array
[
index
-
start
]:
if
inputs
[
index
]
.
dtype
!=
self
.
inputs
[
index_i
]
.
dtype
:
raise
ValueError
(
err_msg1
%
(
'Initial state'
raise
ValueError
(
err_msg1
%
(
'initial state (outputs_info'
' in scan nomenclature) '
,
str
(
inputs
[
index
])
,
index
,
inputs
[
index
]
.
dtype
...
...
@@ -203,7 +214,7 @@ class Scan(PureOp):
index_i
+=
1
for
k
in
self
.
mit_mot_out_slices
[
index
-
start
]:
if
inputs
[
index
]
.
dtype
!=
self
.
outputs
[
index_o
]
.
dtype
:
raise
ValueError
(
err_msg2
%
(
inputs
[
index
]
.
name
raise
ValueError
(
err_msg2
%
(
str
(
inputs
[
index
])
,
index
,
inputs
[
index
]
.
dtype
,
self
.
outputs
[
index_o
]
.
dtype
)
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论