提交 95e9d0f5 authored 作者: lamblin's avatar lamblin

Merge pull request #662 from nouiz/small

Small
...@@ -131,6 +131,7 @@ Community ...@@ -131,6 +131,7 @@ Community
library/index library/index
optimizations optimizations
extending/index extending/index
dev_start_guide
glossary glossary
links links
internal/index internal/index
......
...@@ -115,6 +115,9 @@ import theano and print the config variable, as in: ...@@ -115,6 +115,9 @@ import theano and print the config variable, as in:
This flag's value cannot be modified during the program execution. This flag's value cannot be modified during the program execution.
Do not use upper case letters, only lower case even if NVIDIA use
capital letters.
.. attribute:: force_device .. attribute:: force_device
Bool value: either ``True`` or ``False`` Bool value: either ``True`` or ``False``
......
...@@ -211,6 +211,10 @@ see it fail, you can implement an incorrect ``infer_shape``. ...@@ -211,6 +211,10 @@ see it fail, you can implement an incorrect ``infer_shape``.
.. code-block:: python .. code-block:: python
from theano.tests import unittest_tools as utt
from theano import config
class test_Double(utt.InferShapeTester):
# [...] as previous tests.
def test_infer_shape(self): def test_infer_shape(self):
x = theano.tensor.matrix() x = theano.tensor.matrix()
self._compile_and_check([x], # theano.function inputs self._compile_and_check([x], # theano.function inputs
......
...@@ -78,7 +78,12 @@ from compile import \ ...@@ -78,7 +78,12 @@ from compile import \
from misc.safe_asarray import _asarray from misc.safe_asarray import _asarray
import theano.tests import theano.tests
test = theano.tests.TheanoNoseTester().test if hasattr(theano.tests, "TheanoNoseTester"):
test = theano.tests.TheanoNoseTester().test
else:
def test():
raise ImportError("The nose module is not installed."
" It is needed for Theano tests.")
FancyModule = Module FancyModule = Module
......
...@@ -46,7 +46,8 @@ AddConfigVar('int_division', ...@@ -46,7 +46,8 @@ AddConfigVar('int_division',
AddConfigVar('device', AddConfigVar('device',
("Default device for computations. If gpu*, change the default to try " ("Default device for computations. If gpu*, change the default to try "
"to move computation to it and to put shared variable of float32 " "to move computation to it and to put shared variable of float32 "
"on it."), "on it. Do not use upper case letters, only lower case even if "
"NVIDIA use capital letters."),
EnumStr('cpu', 'gpu', EnumStr('cpu', 'gpu',
'gpu0', 'gpu1', 'gpu2', 'gpu3', 'gpu0', 'gpu1', 'gpu2', 'gpu3',
'gpu4', 'gpu5', 'gpu6', 'gpu7', 'gpu4', 'gpu5', 'gpu6', 'gpu7',
......
...@@ -327,10 +327,17 @@ class TestGpuGemv(TestCase, BaseGemv, ...@@ -327,10 +327,17 @@ class TestGpuGemv(TestCase, BaseGemv,
mode = mode_with_gpu mode = mode_with_gpu
dtype = 'float32' dtype = 'float32'
# As all input are transfered to the gpu, this allow to make all gemv = gpu_gemv_no_inplace
# the gemv inplace.
gemv = gpu_gemv_inplace
gemv_inplace = gpu_gemv_inplace gemv_inplace = gpu_gemv_inplace
# Mimic shared constructors registry
@staticmethod
def shared(val):
# If we don't put shared on the GPU, we won't be able to test
# the no inplace version as the added transfer will make them inplace.
try:
return tcn.shared_constructor(val)
except TypeError:
return theano.shared(val)
class TestGpuGemvNoTransfer(TestCase, BaseGemv, class TestGpuGemvNoTransfer(TestCase, BaseGemv,
...@@ -435,7 +442,7 @@ class TestVectorMatrixDot(TestCase): ...@@ -435,7 +442,7 @@ class TestVectorMatrixDot(TestCase):
def test_gemv2(self): def test_gemv2(self):
''' test vector1+dot(vector2,matrix) ''' ''' test vector1+dot(vector2,matrix) '''
v1 = theano.shared(numpy.array(numpy.random.rand(5), dtype='float32')) v1 = theano.shared(numpy.array(numpy.random.rand(5), dtype='float32'))
v2 = theano.shared(numpy.array(numpy.random.rand(2), dtype='float32')) v2 = tensor._shared(numpy.array(numpy.random.rand(2), dtype='float32'))
m = theano.shared(numpy.array(numpy.random.rand(5, 2), m = theano.shared(numpy.array(numpy.random.rand(5, 2),
dtype='float32')) dtype='float32'))
......
...@@ -378,6 +378,12 @@ def ldflags(libs=True, flags=False, libs_dir=False, include_dir=False): ...@@ -378,6 +378,12 @@ def ldflags(libs=True, flags=False, libs_dir=False, include_dir=False):
"ATLAS, make sure to compile it with dynamics library.") "ATLAS, make sure to compile it with dynamics library.")
for t in config.blas.ldflags.split(): for t in config.blas.ldflags.split():
#Remove extra quote.
if t.startswith("'") or t.startswith('"'):
t = t[1:]
if t.endswith("'") or t.endswith('"'):
t = t[:-1]
try: try:
t0, t1, t2 = t[0:3] t0, t1, t2 = t[0:3]
assert t0 == '-' assert t0 == '-'
......
from main import main, TheanoNoseTester
try:
from main import main, TheanoNoseTester
except ImportError:
pass
import unittest_tools import unittest_tools
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论