提交 7b507e2b authored 作者: Frederic's avatar Frederic

add an option to have a warning printed about the vm/cvm gc bug.

上级 f114b86c
...@@ -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 diabled by default as it 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 "
......
...@@ -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 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)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论