提交 6f829941 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Add flag enabling testing of preallocated storage in DebugMode

上级 05e88458
...@@ -46,6 +46,10 @@ AddConfigVar('DebugMode.warn_input_not_reused', ...@@ -46,6 +46,10 @@ AddConfigVar('DebugMode.warn_input_not_reused',
), ),
BoolParam(True)) BoolParam(True))
AddConfigVar('DebugMode.check_preallocated_output',
'Test thunks with pre-allocated memory as output storage.',
BoolParam(False))
import logging import logging
_logger=logging.getLogger("theano.compile.debugmode") _logger=logging.getLogger("theano.compile.debugmode")
_logger.setLevel(logging.WARNING) _logger.setLevel(logging.WARNING)
...@@ -1194,6 +1198,7 @@ class _Linker(gof.link.LocalLinker): ...@@ -1194,6 +1198,7 @@ class _Linker(gof.link.LocalLinker):
r_vals[r] = storage_map[r][0] r_vals[r] = storage_map[r][0]
storage_map[r][0] = None #clear the storage_map of outputs for the thunk_c storage_map[r][0] = None #clear the storage_map of outputs for the thunk_c
if config.DebugMode.check_preallocated_output:
## Then, try to use different output storages ## Then, try to use different output storages
# reuse_output: use a copy of the same storage returned the first time # reuse_output: use a copy of the same storage returned the first time
# TODO: optimization warning if the storage in reuse_outputs # TODO: optimization warning if the storage in reuse_outputs
...@@ -1326,7 +1331,7 @@ class _Linker(gof.link.LocalLinker): ...@@ -1326,7 +1331,7 @@ class _Linker(gof.link.LocalLinker):
r_vals[r] = storage_map[r][0] r_vals[r] = storage_map[r][0]
storage_map[r][0] = None #clear the storage_map for the thunk_c storage_map[r][0] = None #clear the storage_map for the thunk_c
if config.DebugMode.check_preallocated_output:
## Then, try to use different output storages ## Then, try to use different output storages
# TODO: factorize that code with the one for Python above # TODO: factorize that code with the one for Python above
reuse_outputs = {} reuse_outputs = {}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论