Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
aa13f74f
提交
aa13f74f
authored
5月 06, 2012
作者:
nouiz
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #634 from pascanur/fix_scan_debugmode
Fix scan debugmode
上级
ac42ce74
bcba6436
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
15 行增加
和
16 行删除
+15
-16
scan.py
theano/scan_module/scan.py
+0
-1
scan_op.py
theano/scan_module/scan_op.py
+6
-4
scan_opt.py
theano/scan_module/scan_opt.py
+0
-1
scan_perform.c.txt
theano/scan_module/scan_perform.c.txt
+0
-0
scan_perform.pyx
theano/scan_module/scan_perform.pyx
+5
-6
scan_perform_ext.py
theano/scan_module/scan_perform_ext.py
+1
-1
scan_utils.py
theano/scan_module/scan_utils.py
+3
-3
没有找到文件。
theano/scan_module/scan.py
浏览文件 @
aa13f74f
...
@@ -949,7 +949,6 @@ def scan(fn,
...
@@ -949,7 +949,6 @@ def scan(fn,
info
[
'truncate_gradient'
]
=
truncate_gradient
info
[
'truncate_gradient'
]
=
truncate_gradient
info
[
'name'
]
=
name
info
[
'name'
]
=
name
info
[
'mode'
]
=
mode
info
[
'mode'
]
=
mode
info
[
'inplace'
]
=
-
1
info
[
'destroy_map'
]
=
{}
info
[
'destroy_map'
]
=
{}
info
[
'gpu'
]
=
False
info
[
'gpu'
]
=
False
info
[
'as_while'
]
=
as_while
info
[
'as_while'
]
=
as_while
...
...
theano/scan_module/scan_op.py
浏览文件 @
aa13f74f
...
@@ -528,6 +528,10 @@ class Scan(PureOp):
...
@@ -528,6 +528,10 @@ class Scan(PureOp):
dtype
=
'int32'
)
dtype
=
'int32'
)
cython_vector_outs
=
numpy
.
asarray
(
self
.
vector_outs
,
cython_vector_outs
=
numpy
.
asarray
(
self
.
vector_outs
,
dtype
=
'int32'
)
dtype
=
'int32'
)
cython_destroy_map
=
[
x
in
self
.
destroy_map
for
x
in
xrange
(
len
(
node
.
outputs
))]
cython_destroy_map
=
numpy
.
asarray
(
cython_destroy_map
,
dtype
=
'int32'
)
import
scan_perform_ext
import
scan_perform_ext
p
=
lambda
node
,
args
,
outs
:
\
p
=
lambda
node
,
args
,
outs
:
\
scan_perform_ext
.
perform
(
scan_perform_ext
.
perform
(
...
@@ -549,7 +553,7 @@ class Scan(PureOp):
...
@@ -549,7 +553,7 @@ class Scan(PureOp):
cython_mit_mot_out_nslices
,
cython_mit_mot_out_nslices
,
self
.
fn
.
fn
,
self
.
fn
.
fn
,
self
.
fn
,
self
.
fn
,
self
.
inplace
,
cython_destroy_map
,
args
,
args
,
outs
,
outs
,
self
)
self
)
...
@@ -782,7 +786,7 @@ class Scan(PureOp):
...
@@ -782,7 +786,7 @@ class Scan(PureOp):
in
xrange
(
self
.
n_outs
+
self
.
n_nit_sot
)]
in
xrange
(
self
.
n_outs
+
self
.
n_nit_sot
)]
# 2.1 Create storage space for outputs
# 2.1 Create storage space for outputs
for
idx
in
xrange
(
self
.
n_outs
):
for
idx
in
xrange
(
self
.
n_outs
):
if
self
.
inplace
:
if
idx
in
self
.
destroy_map
:
# ^ Case 1. Outputs should be computed inplace of their
# ^ Case 1. Outputs should be computed inplace of their
# initial state
# initial state
outs
[
idx
][
0
]
=
args
[
self
.
seqs_arg_offset
+
idx
]
outs
[
idx
][
0
]
=
args
[
self
.
seqs_arg_offset
+
idx
]
...
@@ -1451,7 +1455,6 @@ class Scan(PureOp):
...
@@ -1451,7 +1455,6 @@ class Scan(PureOp):
else
:
else
:
info
[
'name'
]
=
None
info
[
'name'
]
=
None
info
[
'mode'
]
=
self
.
mode
info
[
'mode'
]
=
self
.
mode
info
[
'inplace'
]
=
False
n_mit_sot
=
0
n_mit_sot
=
0
n_sit_sot
=
0
n_sit_sot
=
0
...
@@ -1552,7 +1555,6 @@ class Scan(PureOp):
...
@@ -1552,7 +1555,6 @@ class Scan(PureOp):
else
:
else
:
info
[
'name'
]
=
None
info
[
'name'
]
=
None
info
[
'mode'
]
=
self
.
mode
info
[
'mode'
]
=
self
.
mode
info
[
'inplace'
]
=
False
info
[
'mit_mot_out_slices'
]
=
self
.
mit_mot_out_slices
*
2
info
[
'mit_mot_out_slices'
]
=
self
.
mit_mot_out_slices
*
2
new_tap_array
=
[]
new_tap_array
=
[]
b
=
0
b
=
0
...
...
theano/scan_module/scan_opt.py
浏览文件 @
aa13f74f
...
@@ -867,7 +867,6 @@ class ScanMerge(gof.Optimizer):
...
@@ -867,7 +867,6 @@ class ScanMerge(gof.Optimizer):
info
[
'truncate_gradient'
]
=
nodes
[
0
]
.
op
.
truncate_gradient
info
[
'truncate_gradient'
]
=
nodes
[
0
]
.
op
.
truncate_gradient
info
[
'name'
]
=
'&'
.
join
([
nd
.
op
.
name
for
nd
in
nodes
])
info
[
'name'
]
=
'&'
.
join
([
nd
.
op
.
name
for
nd
in
nodes
])
info
[
'mode'
]
=
nodes
[
0
]
.
op
.
mode
info
[
'mode'
]
=
nodes
[
0
]
.
op
.
mode
info
[
'inplace'
]
=
False
info
[
'gpu'
]
=
False
info
[
'gpu'
]
=
False
info
[
'as_while'
]
=
as_while
info
[
'as_while'
]
=
as_while
info
[
'profile'
]
=
nodes
[
0
]
.
op
.
profile
info
[
'profile'
]
=
nodes
[
0
]
.
op
.
profile
...
...
theano/scan_module/scan_perform.c.txt
浏览文件 @
aa13f74f
This source diff could not be displayed because it is too large. You can
view the blob
instead.
theano/scan_module/scan_perform.pyx
浏览文件 @
aa13f74f
...
@@ -63,7 +63,7 @@ from theano.sandbox import cuda
...
@@ -63,7 +63,7 @@ from theano.sandbox import cuda
def get_version():
def get_version():
return 0.2
6
6
return 0.2
7
6
@cython.boundscheck(False)
@cython.boundscheck(False)
def perform(
def perform(
...
@@ -85,7 +85,7 @@ def perform(
...
@@ -85,7 +85,7 @@ def perform(
numpy.ndarray[numpy.int32_t,ndim=1] mit_mot_out_nslices,
numpy.ndarray[numpy.int32_t,ndim=1] mit_mot_out_nslices,
fn,
fn,
fnct,
fnct,
bint inplace
,
numpy.ndarray[numpy.int32_t,ndim=1] destroy_map
,
args,
args,
outs,
outs,
self):
self):
...
@@ -145,9 +145,8 @@ def perform(
...
@@ -145,9 +145,8 @@ def perform(
fnct: python object
fnct: python object
Only used to attach some timings for the profile mode ( can be
Only used to attach some timings for the profile mode ( can be
skiped if we don't care about Theano's profile mode)
skiped if we don't care about Theano's profile mode)
inplace
destroy_map
Boolean that says if things should be computed inplace or if they
Array of boolean saying if an output is computed inplace
should not.
args: list of ndarrays (and random states)
args: list of ndarrays (and random states)
The inputs of scan in a given order ( n_steps, sequences, mit_mot,
The inputs of scan in a given order ( n_steps, sequences, mit_mot,
mit_sot, sit_sot, nit_sot, shared_outs, other_args)
mit_sot, sit_sot, nit_sot, shared_outs, other_args)
...
@@ -230,7 +229,7 @@ def perform(
...
@@ -230,7 +229,7 @@ def perform(
# 2.1 Create storage space for outputs
# 2.1 Create storage space for outputs
for idx in range(n_outs):
for idx in range(n_outs):
if
inplace
:
if
destroy_map[idx] != 0
:
# ^ Case 1. Outputs should be computed inplace of their
# ^ Case 1. Outputs should be computed inplace of their
# initial state
# initial state
outs[idx][0] = args[ <unsigned int>(1+ n_seqs + idx)]
outs[idx][0] = args[ <unsigned int>(1+ n_seqs + idx)]
...
...
theano/scan_module/scan_perform_ext.py
浏览文件 @
aa13f74f
...
@@ -14,7 +14,7 @@ logging.basicConfig(level=logging.DEBUG)
...
@@ -14,7 +14,7 @@ logging.basicConfig(level=logging.DEBUG)
if
config
.
compiledir
not
in
sys
.
path
:
if
config
.
compiledir
not
in
sys
.
path
:
sys
.
path
.
append
(
config
.
compiledir
)
sys
.
path
.
append
(
config
.
compiledir
)
version
=
0.2
6
6
# must match constant returned in function get_version()
version
=
0.2
7
6
# must match constant returned in function get_version()
need_reload
=
False
need_reload
=
False
try
:
try
:
...
...
theano/scan_module/scan_utils.py
浏览文件 @
aa13f74f
...
@@ -592,7 +592,6 @@ def compress_outs(op, not_required, inputs):
...
@@ -592,7 +592,6 @@ def compress_outs(op, not_required, inputs):
info
[
'n_nit_sot'
]
=
0
info
[
'n_nit_sot'
]
=
0
info
[
'truncate_gradient'
]
=
op
.
info
[
'truncate_gradient'
]
info
[
'truncate_gradient'
]
=
op
.
info
[
'truncate_gradient'
]
info
[
'name'
]
=
op
.
info
[
'name'
]
info
[
'name'
]
=
op
.
info
[
'name'
]
info
[
'inplace'
]
=
op
.
info
[
'inplace'
]
info
[
'gpu'
]
=
op
.
info
[
'gpu'
]
info
[
'gpu'
]
=
op
.
info
[
'gpu'
]
info
[
'mode'
]
=
op
.
info
[
'mode'
]
info
[
'mode'
]
=
op
.
info
[
'mode'
]
info
[
'as_while'
]
=
op
.
info
[
'as_while'
]
info
[
'as_while'
]
=
op
.
info
[
'as_while'
]
...
@@ -857,9 +856,10 @@ class scan_args(object):
...
@@ -857,9 +856,10 @@ class scan_args(object):
q
+=
n_shared_outs
q
+=
n_shared_outs
self
.
other_info
=
dict
()
self
.
other_info
=
dict
()
for
k
in
(
'truncate_gradient'
,
'name'
,
'mode'
,
'
inplace
'
,
for
k
in
(
'truncate_gradient'
,
'name'
,
'mode'
,
'
destroy_map
'
,
'gpu'
,
'as_while'
,
'profile'
):
'gpu'
,
'as_while'
,
'profile'
):
self
.
other_info
[
k
]
=
info
[
k
]
if
k
in
info
:
self
.
other_info
[
k
]
=
info
[
k
]
inner_inputs
=
property
(
lambda
self
:
(
self
.
inner_in_seqs
+
inner_inputs
=
property
(
lambda
self
:
(
self
.
inner_in_seqs
+
sum
(
self
.
inner_in_mit_mot
,
[])
+
sum
(
self
.
inner_in_mit_mot
,
[])
+
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论