Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
6b5b2534
提交
6b5b2534
authored
7月 30, 2012
作者:
lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #798 from nouiz/vm_gc_follow_up
Vm gc follow up
上级
06bfd9e2
fb545ff5
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
41 行增加
和
6 行删除
+41
-6
configdefaults.py
theano/configdefaults.py
+11
-0
test_vm.py
theano/gof/tests/test_vm.py
+6
-0
vm.py
theano/gof/vm.py
+22
-4
do_nightly_build
theano/misc/do_nightly_build
+2
-2
没有找到文件。
theano/configdefaults.py
浏览文件 @
6b5b2534
...
@@ -339,6 +339,17 @@ AddConfigVar('warn.gpu_set_subtensor1',
...
@@ -339,6 +339,17 @@ AddConfigVar('warn.gpu_set_subtensor1',
BoolParam
(
warn_default
(
'0.6'
)),
BoolParam
(
warn_default
(
'0.6'
)),
in_c_key
=
False
)
in_c_key
=
False
)
AddConfigVar
(
'warn.vm_gc_bug'
,
"There was a bug that existed in the default Theano configuration"
" just in the development version between July 5 2012"
" and July 30 2012. This was not in a released version."
" If your code was affected by this bug, a warning"
" will be printed during the code execution if you use the"
"`linker=vm,vm.lazy=True,warn.vm_gc_bug=True` Theano flags."
"This warning is disabled by default as the bug was not released."
,
BoolParam
(
False
),
in_c_key
=
False
)
AddConfigVar
(
'compute_test_value'
,
AddConfigVar
(
'compute_test_value'
,
(
"If 'True', Theano will run each op at graph build time, using "
(
"If 'True', Theano will run each op at graph build time, using "
"Constants, SharedVariables and the tag 'test_value' as inputs "
"Constants, SharedVariables and the tag 'test_value' as inputs "
...
...
theano/gof/tests/test_vm.py
浏览文件 @
6b5b2534
...
@@ -306,3 +306,9 @@ def test_vm_gc():
...
@@ -306,3 +306,9 @@ def test_vm_gc():
f
=
theano
.
function
([
theano
.
In
(
x
,
mutable
=
True
)],
[
p
+
1
,
p
+
2
],
f
=
theano
.
function
([
theano
.
In
(
x
,
mutable
=
True
)],
[
p
+
1
,
p
+
2
],
mode
=
mode
)
mode
=
mode
)
f
([
1
,
2
,
3
])
f
([
1
,
2
,
3
])
p
=
RunOnce
()(
x
)
pp
=
p
+
p
f
=
theano
.
function
([
x
],
[
pp
+
pp
],
mode
=
mode
)
f
([
1
,
2
,
3
])
theano/gof/vm.py
浏览文件 @
6b5b2534
...
@@ -3,10 +3,12 @@ VMs that run Theano graph computations.
...
@@ -3,10 +3,12 @@ VMs that run Theano graph computations.
A VM is not actually different from a Linker, we just decided
A VM is not actually different from a Linker, we just decided
VM was a better name at some point
VM was a better name at some point
"""
"""
import
link
import
logging
import
logging
import
sys
import
sys
import
time
import
time
import
link
import
warnings
from
theano.gof.python25
import
all
from
theano.gof.python25
import
all
import
theano
import
theano
...
@@ -396,6 +398,19 @@ class Stack(VM):
...
@@ -396,6 +398,19 @@ class Stack(VM):
#recomputed! This can cause wrong value
#recomputed! This can cause wrong value
#with some combiation of inplace op.
#with some combiation of inplace op.
compute_map
[
i
][
0
]
=
2
compute_map
[
i
][
0
]
=
2
if
(
config
.
warn
.
vm_gc_bug
and
current_apply
in
apply_stack
and
getattr
(
current_apply
.
op
,
'destroy_map'
,
False
)):
warnings
.
warn
(
"There was a bug that existed in the default Theano configuration"
" just in the development version between July 5 2012"
" and July 30 2012. This was not in a released version."
"The bug was affecting this script."
,
#The stack level is not good when inside a Scan.
stacklevel
=
3
)
elif
not
computed_ins
:
elif
not
computed_ins
:
# -- Non-lazy case, need inputs
# -- Non-lazy case, need inputs
apply_stack
.
append
(
current_apply
)
apply_stack
.
append
(
current_apply
)
...
@@ -505,10 +520,11 @@ class VM_Linker(link.LocalLinker):
...
@@ -505,10 +520,11 @@ class VM_Linker(link.LocalLinker):
the virtual machine. It will be called with four arguments called
the virtual machine. It will be called with four arguments called
'node', 'thunk', 'storage_map', and 'compute_map'.
'node', 'thunk', 'storage_map', and 'compute_map'.
lazy - Useful only when use_cloop is False. When lazy is None, auto
lazy - Useful only when use_cloop is False. When lazy is None, use the
theano flag vm.lazy value. Then if we have a None(default) we auto
detect if lazy evaluation is needed and use the apropriate
detect if lazy evaluation is needed and use the apropriate
version. If lazy i
t True/False, force the version used between
version. If lazy i
s True or False, we force the version used
Loop/LoopGC and Stack.
between
Loop/LoopGC and Stack.
"""
"""
if
allow_gc
is
None
:
if
allow_gc
is
None
:
...
@@ -712,6 +728,8 @@ class VM_Linker(link.LocalLinker):
...
@@ -712,6 +728,8 @@ class VM_Linker(link.LocalLinker):
assert
c0
==
sys
.
getrefcount
(
node_n_inputs
)
assert
c0
==
sys
.
getrefcount
(
node_n_inputs
)
else
:
else
:
lazy
=
self
.
lazy
lazy
=
self
.
lazy
if
lazy
is
None
:
lazy
=
config
.
vm
.
lazy
if
lazy
is
None
:
if
lazy
is
None
:
lazy
=
not
all
([(
not
th
.
lazy
)
for
th
in
thunks
])
lazy
=
not
all
([(
not
th
.
lazy
)
for
th
in
thunks
])
if
not
lazy
:
if
not
lazy
:
...
...
theano/misc/do_nightly_build
浏览文件 @
6b5b2534
...
@@ -68,8 +68,8 @@ THEANO_FLAGS=${FLAGS},mode=FAST_RUN,floatX=float32 ${NOSETESTS} ${ARGS}
...
@@ -68,8 +68,8 @@ THEANO_FLAGS=${FLAGS},mode=FAST_RUN,floatX=float32 ${NOSETESTS} ${ARGS}
echo
"Number of elements in the compiledir:"
echo
"Number of elements in the compiledir:"
ls
${
COMPILEDIR
}
|wc
-l
ls
${
COMPILEDIR
}
|wc
-l
echo
"Executing nosetests with
mode
=vm,vm.lazy=True,floatX=float32"
echo
"Executing nosetests with
linker
=vm,vm.lazy=True,floatX=float32"
THEANO_FLAGS
=
${
FLAGS
}
,
mode
=
vm,vm.lazy
=
True,floatX
=
float32
${
NOSETESTS
}
${
ARGS
}
THEANO_FLAGS
=
${
FLAGS
}
,
linker
=
vm,vm.lazy
=
True,floatX
=
float32
${
NOSETESTS
}
${
ARGS
}
echo
"Number of elements in the compiledir:"
echo
"Number of elements in the compiledir:"
ls
${
COMPILEDIR
}
|wc
-l
ls
${
COMPILEDIR
}
|wc
-l
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论