Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
8759f6a7
提交
8759f6a7
authored
11月 01, 2012
作者:
Razvan Pascanu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
return disconnected type instead of undefined
上级
781f9e8b
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
10 行增加
和
10 行删除
+10
-10
scan_op.py
theano/scan_module/scan_op.py
+10
-10
没有找到文件。
theano/scan_module/scan_op.py
浏览文件 @
8759f6a7
...
@@ -1249,7 +1249,8 @@ class Scan(PureOp):
...
@@ -1249,7 +1249,8 @@ class Scan(PureOp):
return
ipos
+
opos
return
ipos
+
opos
def
connection_pattern
(
self
,
node
):
def
connection_pattern
(
self
,
node
):
connection_pattern
=
[[
True
for
output
in
node
.
outputs
]]
# The gradient wrt to n_steps is disconnected
connection_pattern
=
[[
False
for
output
in
node
.
outputs
]]
connection_pattern
+=
[[
False
for
output
in
node
.
outputs
]
connection_pattern
+=
[[
False
for
output
in
node
.
outputs
]
for
x
in
node
.
inputs
[
1
:]]
for
x
in
node
.
inputs
[
1
:]]
...
@@ -1286,8 +1287,7 @@ class Scan(PureOp):
...
@@ -1286,8 +1287,7 @@ class Scan(PureOp):
else
:
else
:
e
=
len
(
self
.
tap_array
[
0
])
e
=
len
(
self
.
tap_array
[
0
])
p
=
iidx
p
=
iidx
if
(
node
.
inputs
[
iidx
+
1
]
in
self
.
outer_nitsot
(
node
)
or
if
node
.
inputs
[
iidx
+
1
]
in
self
.
outer_nitsot
(
node
)
node
.
inputs
[
iidx
+
1
]
in
self
.
outer_shared
(
node
)):
return
None
return
None
if
node
.
inputs
[
iidx
+
1
]
in
self
.
outer_non_seqs
(
node
):
if
node
.
inputs
[
iidx
+
1
]
in
self
.
outer_non_seqs
(
node
):
loc_idx
=
self
.
outer_non_seqs
(
node
)
.
index
(
loc_idx
=
self
.
outer_non_seqs
(
node
)
.
index
(
...
@@ -1298,8 +1298,10 @@ class Scan(PureOp):
...
@@ -1298,8 +1298,10 @@ class Scan(PureOp):
s
=
e
s
=
e
if
p
<
self
.
n_seqs
:
if
p
<
self
.
n_seqs
:
e
+=
1
e
+=
1
el
se
:
el
if
p
-
self
.
n_seqs
<
len
(
self
.
tap_array
)
:
e
+=
len
(
self
.
tap_array
[
p
-
self
.
n_seqs
])
e
+=
len
(
self
.
tap_array
[
p
-
self
.
n_seqs
])
else
:
e
+=
1
return
self
.
inputs
[
s
:
e
]
return
self
.
inputs
[
s
:
e
]
for
oidx
,
out
in
enumerate
(
node
.
outputs
):
for
oidx
,
out
in
enumerate
(
node
.
outputs
):
...
@@ -1308,8 +1310,8 @@ class Scan(PureOp):
...
@@ -1308,8 +1310,8 @@ class Scan(PureOp):
ils
=
_get_inner_inps
(
iidx
)
ils
=
_get_inner_inps
(
iidx
)
if
ils
is
None
:
if
ils
is
None
:
# The gradient should be
undefined, not
disconnected
# The gradient should be disconnected
connection_pattern
[
iidx
+
1
][
oidx
]
=
Tru
e
connection_pattern
[
iidx
+
1
][
oidx
]
=
Fals
e
else
:
else
:
for
inner_out
in
ols
:
for
inner_out
in
ols
:
if
hasattr
(
inner_out
,
'dtype'
):
if
hasattr
(
inner_out
,
'dtype'
):
...
@@ -1662,7 +1664,7 @@ class Scan(PureOp):
...
@@ -1662,7 +1664,7 @@ class Scan(PureOp):
if
type
(
outputs
)
not
in
(
list
,
tuple
):
if
type
(
outputs
)
not
in
(
list
,
tuple
):
outputs
=
[
outputs
]
outputs
=
[
outputs
]
# Re-order the gradients correctly
# Re-order the gradients correctly
gradients
=
[
grad_undefined
(
self
,
0
,
inputs
[
0
],
'Number of steps'
)]
gradients
=
[
DisconnectedType
()(
)]
offset
=
(
self
.
n_mit_mot
+
offset
=
(
self
.
n_mit_mot
+
self
.
n_mit_sot
+
self
.
n_mit_sot
+
...
@@ -1702,9 +1704,7 @@ class Scan(PureOp):
...
@@ -1702,9 +1704,7 @@ class Scan(PureOp):
'Shared Variable with update'
)
'Shared Variable with update'
)
for
x
in
xrange
(
self
.
n_shared_outs
)]
for
x
in
xrange
(
self
.
n_shared_outs
)]
start
=
len
(
gradients
)
start
=
len
(
gradients
)
gradients
+=
[
gradients
+=
[
DisconnectedType
()()
grad_undefined
(
self
,
x
+
start
,
inputs
[
x
+
start
],
'Dimension of memory buffer for output'
)
for
x
in
xrange
(
self
.
n_nit_sot
)]
for
x
in
xrange
(
self
.
n_nit_sot
)]
begin
=
end
begin
=
end
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论