Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
e7732cfc
提交
e7732cfc
authored
12月 13, 2012
作者:
Razvan Pascanu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
PEP8
上级
816d2e75
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
7 行增加
和
13 行删除
+7
-13
scan_op.py
theano/scan_module/scan_op.py
+4
-4
scan_opt.py
theano/scan_module/scan_opt.py
+2
-5
scan_utils.py
theano/scan_module/scan_utils.py
+1
-4
没有找到文件。
theano/scan_module/scan_op.py
浏览文件 @
e7732cfc
...
...
@@ -1375,13 +1375,13 @@ class Scan(PureOp):
def
compute_gradient
(
y
,
g_y
):
if
'int'
in
str
(
g_y
.
dtype
):
raise
TypeError
(
"Gradients may never be integers but g_y "
"has type "
+
str
(
g_y
.
type
))
"has type "
+
str
(
g_y
.
type
))
wrt
=
[
x
for
x
in
theano
.
gof
.
graph
.
inputs
([
y
])
if
x
in
diff_inputs
]
grads
=
gradient
.
grad
(
cost
=
None
,
known_grads
=
{
y
:
g_y
},
cost
=
None
,
known_grads
=
{
y
:
g_y
},
wrt
=
wrt
,
consider_constant
=
wrt
,
disconnected_inputs
=
'ignore'
,
return_disconnected
=
'None'
)
...
...
@@ -1727,7 +1727,7 @@ class Scan(PureOp):
node
=
outs
[
0
]
.
owner
for
idx
in
xrange
(
self
.
n_shared_outs
):
disconnected
=
True
connected_flags
=
self
.
connection_pattern
(
node
)[
idx
+
start
]
connected_flags
=
self
.
connection_pattern
(
node
)[
idx
+
start
]
for
dC_dout
,
connected
in
zip
(
dC_douts
,
connected_flags
):
if
(
not
isinstance
(
dC_dout
.
type
,
DisconnectedType
)
and
connected
):
...
...
theano/scan_module/scan_opt.py
浏览文件 @
e7732cfc
...
...
@@ -1342,7 +1342,7 @@ def scan_merge_inouts(node):
return
o
def
map_nitsot_out
(
i
,
o
,
sh
,
seen
):
for
p
,(
si
,
so
,
ssh
)
in
enumerate
(
seen
):
for
p
,
(
si
,
so
,
ssh
)
in
enumerate
(
seen
):
if
equal_computations
([
i
],
[
si
],
left
,
right
):
if
equal_computations
([
sh
],
[
ssh
]):
return
so
...
...
@@ -1354,7 +1354,7 @@ def scan_merge_inouts(node):
if
vsh
==
vssh
:
return
so
elif
vsh
>
vssh
:
seen
[
p
]
=
(
i
,
o
,
sh
)
seen
[
p
]
=
(
i
,
o
,
sh
)
return
o
else
:
return
so
[:
vsh
]
...
...
@@ -1384,9 +1384,6 @@ def scan_merge_inouts(node):
na
.
outer_out_nit_sot
,
shapes
)]
seen
=
[]
na
.
outer_out_sit_sot
=
[
map_out
(
i
,
o
,
seen
)
for
i
,
o
in
zip
(
na
.
inner_out_sit_sot
,
...
...
theano/scan_module/scan_utils.py
浏览文件 @
e7732cfc
...
...
@@ -191,8 +191,6 @@ def get_updates_and_outputs(ls):
this function know how to put it in that order?
"""
def
is_outputs
(
elem
):
if
(
isinstance
(
elem
,
(
list
,
tuple
))
and
all
([
isinstance
(
x
,
theano
.
Variable
)
for
x
in
elem
])):
...
...
@@ -206,7 +204,7 @@ def get_updates_and_outputs(ls):
# Make sure the updates will be applied in a deterministic order
if
not
isinstance
(
elem
,
gof
.
python25
.
OrderedDict
):
warnings
.
warn
(
"Expected OrderedDict or OrderedUpdates, got "
\
+
str
(
type
(
elem
))
+
". This can make your script non-"
+
str
(
type
(
elem
))
+
". This can make your script non-"
"deterministic."
)
return
True
# Dictionaries can be given as lists of tuples
...
...
@@ -253,7 +251,6 @@ def get_updates_and_outputs(ls):
'values, you can use `tensor.constant` to turn them into '
'Theano variables.'
)
if
is_outputs
(
ls
):
return
None
,
_list
(
ls
),
OrderedDict
()
if
is_updates
(
ls
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论