提交 7bad2e2a authored 作者: abergeron's avatar abergeron

Merge pull request #3867 from nouiz/small

small stuff, tests, doc, docgen.py bugfix, doc, small code cleanup
...@@ -4,10 +4,6 @@ ...@@ -4,10 +4,6 @@
Installing Theano Installing Theano
================= =================
.. note::
If you are a member of LISA Labo, have a look at :ref:`lisa_labo` for
lab-specific installation instructions.
Requirements Requirements
------------ ------------
......
...@@ -31,7 +31,7 @@ if __name__ == '__main__': ...@@ -31,7 +31,7 @@ if __name__ == '__main__':
'processed. Specifying files will implies --cache.') 'processed. Specifying files will implies --cache.')
sys.exit(0) sys.exit(0)
if options['--rst'] or options['--test']: if not(options['--rst'] or options['--test']):
# Default is now rst # Default is now rst
options['--rst'] = True options['--rst'] = True
...@@ -45,6 +45,7 @@ if __name__ == '__main__': ...@@ -45,6 +45,7 @@ if __name__ == '__main__':
files = None files = None
if len(args) != 0: if len(args) != 0:
files = [os.path.abspath(f) for f in args] files = [os.path.abspath(f) for f in args]
currentdir = os.getcwd()
mkdir(outdir) mkdir(outdir)
os.chdir(outdir) os.chdir(outdir)
...@@ -91,3 +92,5 @@ if __name__ == '__main__': ...@@ -91,3 +92,5 @@ if __name__ == '__main__':
mkdir("doc") mkdir("doc")
sys.path[0:0] = [os.path.join(throot, 'doc')] sys.path[0:0] = [os.path.join(throot, 'doc')]
call_sphinx('doctest', '.') call_sphinx('doctest', '.')
# To go back to the original current directory.
os.chdir(currentdir)
...@@ -22,6 +22,10 @@ models between machines. ...@@ -22,6 +22,10 @@ models between machines.
cases observed, but make sure to double-check your results before cases observed, but make sure to double-check your results before
publishing a paper or anything of the sort. publishing a paper or anything of the sort.
.. note::
For data-parallelism, you probably are better using `platoon
<https://github.com/mila-udem/platoon>`_.
Defining the context map Defining the context map
------------------------ ------------------------
......
...@@ -286,7 +286,8 @@ class TestComputeTestValue(unittest.TestCase): ...@@ -286,7 +286,8 @@ class TestComputeTestValue(unittest.TestCase):
# Get frame info 4 layers up # Get frame info 4 layers up
frame_info = traceback.extract_tb(tb)[-5] frame_info = traceback.extract_tb(tb)[-5]
# We should be in the "fx" function defined above # We should be in the "fx" function defined above
assert os.path.split(frame_info[0])[1] == 'test_compute_test_value.py' expected = 'test_compute_test_value.py'
assert os.path.split(frame_info[0])[1] == expected, frame_info
assert frame_info[2] == 'fx' assert frame_info[2] == 'fx'
finally: finally:
......
...@@ -44,6 +44,8 @@ class StripPickler(Pickler): ...@@ -44,6 +44,8 @@ class StripPickler(Pickler):
""" """
Subclass of Pickler that strips unnecessary attributes from Theano objects. Subclass of Pickler that strips unnecessary attributes from Theano objects.
.. versionadded:: 0.8
Example of use:: Example of use::
fn_args = dict(inputs=inputs, fn_args = dict(inputs=inputs,
...@@ -117,6 +119,8 @@ if PY3: ...@@ -117,6 +119,8 @@ if PY3:
""" """
Allow to reload in python 3 some pickled numpy ndarray. Allow to reload in python 3 some pickled numpy ndarray.
.. versionadded:: 0.8
Examples Examples
-------- --------
...@@ -136,6 +140,8 @@ else: ...@@ -136,6 +140,8 @@ else:
""" """
Allow to reload in python 3 some pickled numpy ndarray. Allow to reload in python 3 some pickled numpy ndarray.
.. versionadded:: 0.8
Examples Examples
-------- --------
...@@ -305,6 +311,7 @@ def dump(obj, file_handler, protocol=DEFAULT_PROTOCOL, ...@@ -305,6 +311,7 @@ def dump(obj, file_handler, protocol=DEFAULT_PROTOCOL,
separate NPY file inside of the zip file. separate NPY file inside of the zip file.
:type persistent_id: callable :type persistent_id: callable
.. versionadded:: 0.8
.. note:: .. note::
The final file is simply a zipped file containing at least one file, The final file is simply a zipped file containing at least one file,
...@@ -347,6 +354,7 @@ def load(f, persistent_load=PersistentNdarrayLoad): ...@@ -347,6 +354,7 @@ def load(f, persistent_load=PersistentNdarrayLoad):
used when pickling. used when pickling.
:type persistent_load: callable, optional :type persistent_load: callable, optional
.. versionadded:: 0.8
""" """
with closing(zipfile.ZipFile(f, 'r')) as zip_file: with closing(zipfile.ZipFile(f, 'r')) as zip_file:
p = pickle.Unpickler(BytesIO(zip_file.open('pkl').read())) p = pickle.Unpickler(BytesIO(zip_file.open('pkl').read()))
......
...@@ -1028,7 +1028,7 @@ def pydotprint(fct, outfile=None, ...@@ -1028,7 +1028,7 @@ def pydotprint(fct, outfile=None,
except pd.InvocationException: except pd.InvocationException:
# based on https://github.com/Theano/Theano/issues/2988 # based on https://github.com/Theano/Theano/issues/2988
version = getattr(pd, '__version__', "") version = getattr(pd, '__version__', "")
if version and list(map(int, version.split("."))) < [1, 0, 28]: if version and [int(n) for n in version.split(".")] < [1, 0, 28]:
raise Exception("Old version of pydot detected, which can " raise Exception("Old version of pydot detected, which can "
"cause issues with pydot printing. Try " "cause issues with pydot printing. Try "
"upgrading pydot version to a newer one") "upgrading pydot version to a newer one")
......
import os.path import os.path
from nose.plugins.skip import SkipTest
from nose.tools import assert_raises from nose.tools import assert_raises
import numpy import numpy
...@@ -8,7 +9,9 @@ from theano.compat import PY3 ...@@ -8,7 +9,9 @@ from theano.compat import PY3
from theano.misc.pkl_utils import CompatUnpickler from theano.misc.pkl_utils import CompatUnpickler
from theano.sandbox.cuda import cuda_available from theano.sandbox.cuda import cuda_available
if cuda_available: if not cuda_available:
raise SkipTest('Optional package cuda disabled')
else:
from theano.sandbox.cuda import CudaNdarray from theano.sandbox.cuda import CudaNdarray
# testfile created on cuda enabled machine using # testfile created on cuda enabled machine using
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论