提交 b52f16ff authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Enumerate modes and linkers to test. Remove printing of profile infos.

上级 bf0eb407
...@@ -5,6 +5,7 @@ import unittest ...@@ -5,6 +5,7 @@ import unittest
import theano import theano
import theano.tensor as T import theano.tensor as T
from theano.compile import Mode, ProfileMode
class T_bunch_of_modes(unittest.TestCase): class T_bunch_of_modes(unittest.TestCase):
...@@ -13,15 +14,25 @@ class T_bunch_of_modes(unittest.TestCase): ...@@ -13,15 +14,25 @@ class T_bunch_of_modes(unittest.TestCase):
# this is a quick test after the LazyLinker branch merge # this is a quick test after the LazyLinker branch merge
# to check that all the current modes can still be used. # to check that all the current modes can still be used.
linker_classes_involved = [] linker_classes_involved = []
for modename in theano.config.__class__.__dict__['mode'].all:
predef_modes = ['FAST_COMPILE', 'FAST_RUN', 'DEBUG_MODE']
# Use a new instance of ProfileMode instead of 'PROFILE_MODE' to
# avoid printing a profile mode summary in nose output
predef_modes.append(ProfileMode())
# Linkers to use with regular Mode
linkers = ['c|py', 'c|py_nogc', 'vm', 'vm_nogc', 'cvm', 'cvm_nogc']
modes = predef_modes + [Mode(linker, 'fast_run') for linker in linkers]
for mode in modes:
x = T.matrix() x = T.matrix()
y = T.vector() y = T.vector()
f = theano.function([x,y], x+y, mode=modename) f = theano.function([x,y], x+y, mode=mode)
# test that it runs something # test that it runs something
f([[1,2],[3,4]], [5, 6]) f([[1,2],[3,4]], [5, 6])
linker_classes_involved.append(f.maker.mode.linker.__class__) linker_classes_involved.append(f.maker.mode.linker.__class__)
print 'MODE:', modename, f.maker.mode.linker, 'stop' print 'MODE:', mode, f.maker.mode.linker, 'stop'
# regression check: # regression check:
# there should be # there should be
# - VM_Linker # - VM_Linker
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论