提交 0d423a9d authored 作者: Frédéric Bastien's avatar Frédéric Bastien 提交者: GitHub

Merge pull request #6120 from lamblin/better_travis

Various improvements for Travis
......@@ -10,9 +10,7 @@ cache:
language: python
python:
- "2.7"
- "3.4"
# For now, Python versions have to be listed in the "jobs" matrix
# NB:
# In before_install and install sections below,
......@@ -42,33 +40,64 @@ install:
# nose-exclude plugin allow us to tell nosetests to exclude folder with --exclude-dir=path/to/directory.
- pip install nose-exclude nose-timer
# command to run tests
env:
- PART="theano/tests/test_flake8.py" DOC=1
- PART="-e test_flake8.py theano/compat theano/compile theano/d3viz theano/gof theano/misc theano/sandbox theano/scalar theano/scan_module theano/sparse theano/tests theano/typed_list"
- PART="theano/tensor -e test_basic.py --exclude-dir=theano/tensor/nnet"
- PART="theano/tensor/tests/test_basic.py"
- PART="theano/tensor/nnet -e test_abstract_conv.py"
- PART="theano/tensor/nnet/tests/test_abstract_conv.py"
matrix:
fast_finish: true
jobs:
include:
- python: "3.4"
env: PART="--exclude-dir=theano/tensor -e test_flake8.py ." THEANO_FLAGS="mode=FAST_COMPILE"
- python: "3.4"
env: PART="theano/tensor --exclude-dir=theano/tensor/nnet" THEANO_FLAGS="mode=FAST_COMPILE"
- python: "3.4"
env: PART="theano/tensor/nnet" THEANO_FLAGS="mode=FAST_COMPILE"
- python: "2.7"
env: PART="--exclude-dir=theano/tensor -e test_flake8.py ." THEANO_FLAGS="mode=FAST_COMPILE,floatX=float32"
- python: "2.7"
env: PART="theano/tensor --exclude-dir=theano/tensor/nnet" THEANO_FLAGS="mode=FAST_COMPILE,floatX=float32"
- python: "2.7"
env: PART="theano/tensor/nnet" THEANO_FLAGS="mode=FAST_COMPILE,floatX=float32"
# define prototype for doctest
- &doctest
stage: doc
python: "2.7"
env: DOC=1 PART="theano/tests/test_flake8.py"
# re-use prototype, changing the Python version
- <<: *doctest
python: "3.4"
- &normaltest
stage: test
python: "2.7"
env: PART="theano/compat theano/compile theano/d3viz theano/gof theano/misc theano/sandbox theano/scalar theano/scan_module theano/sparse theano/tests -e test_flake8.py theano/typed_list"
- <<: *normaltest
python: "3.4"
- <<: *normaltest
env: PART="theano/tensor -e test_basic.py --exclude-dir=theano/tensor/nnet"
- <<: *normaltest
python: "3.4"
env: PART="theano/tensor -e test_basic.py --exclude-dir=theano/tensor/nnet"
- <<: *normaltest
env: PART="theano/tensor/tests/test_basic.py"
- <<: *normaltest
python: "3.4"
env: PART="theano/tensor/tests/test_basic.py"
- <<: *normaltest
env: PART="theano/tensor/nnet -e test_abstract_conv.py"
- <<: *normaltest
python: "3.4"
env: PART="theano/tensor/nnet -e test_abstract_conv.py"
- <<: *normaltest
env: PART="theano/tensor/nnet/tests/test_abstract_conv.py"
- <<: *normaltest
python: "3.4"
env: PART="theano/tensor/nnet/tests/test_abstract_conv.py"
- <<: *normaltest
env: FAST_COMPILE=1 FLOAT32=1 PART="--exclude-dir=theano/tensor -e test_flake8.py ."
- <<: *normaltest
python: "3.4"
env: FAST_COMPILE=1 PART="--exclude-dir=theano/tensor -e test_flake8.py ."
- <<: *normaltest
env: FAST_COMPILE=1 FLOAT32=1 PART="theano/tensor --exclude-dir=theano/tensor/nnet"
- <<: *normaltest
python: "3.4"
env: FAST_COMPILE=1 PART="theano/tensor --exclude-dir=theano/tensor/nnet"
- <<: *normaltest
env: FAST_COMPILE=1 FLOAT32=1 PART="theano/tensor/nnet"
- <<: *normaltest
python: "3.4"
env: FAST_COMPILE=1 PART="theano/tensor/nnet"
script:
- if [[ $FAST_COMPILE == "1" ]]; then export THEANO_FLAGS=$THEANO_FLAGS,mode=FAST_COMPILE; fi
- if [[ $FLOAT32 == "1" ]]; then export THEANO_FLAGS=$THEANO_FLAGS,floatX=float32; fi
- export THEANO_FLAGS=$THEANO_FLAGS,warn.ignore_bug_before=all,on_opt_error=raise,on_shape_error=raise,gcc.cxxflags=-pipe
- export MKL_NUM_THREADS=1
- export OMP_NUM_THREADS=1
- python --version
- uname -a
- free -m
......
......@@ -9,6 +9,6 @@ else
fi
source activate pyenv
if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then conda install --yes -q mkl numpy=1.9.1 scipy=0.14.0 nose=1.3.0 pip flake8=2.3 six=1.9.0 pep8=1.6.2 pyflakes=0.8.1 sphinx=1.5.1 mkl-service libgfortran=1; fi
if [[ $TRAVIS_PYTHON_VERSION == '3.4' ]]; then conda install --yes -q mkl numpy=1.9.1 scipy=0.14.0 nose=1.3.4 pip flake8=2.3 six=1.9.0 pep8=1.6.2 pyflakes=0.8.1 sphinx=1.5.1 mkl-service libgfortran=1; fi
if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then conda install --yes -q mkl numpy=1.9.1 scipy=0.14.0 nose=1.3.0 pip flake8=2.3 six=1.9.0 pep8=1.6.2 pyflakes=0.8.1 sphinx=1.5.1 mkl-service libgfortran=1 graphviz; fi
if [[ $TRAVIS_PYTHON_VERSION == '3.4' ]]; then conda install --yes -q mkl numpy=1.9.1 scipy=0.14.0 nose=1.3.4 pip flake8=2.3 six=1.9.0 pep8=1.6.2 pyflakes=0.8.1 sphinx=1.5.1 mkl-service libgfortran=1 graphviz; fi
source deactivate
......@@ -17,7 +17,7 @@ from theano.compat import izip
from six.moves import xrange, reduce
from theano.gof.null_type import NullType, null_type
from theano.gof.op import get_debug_values
from theano.compile import ViewOp, FAST_RUN, DebugMode
from theano.compile import ViewOp, FAST_RUN, DebugMode, get_mode
__authors__ = "James Bergstra, Razvan Pascanu, Arnaud Bergeron, Ian Goodfellow"
__copyright__ = "(c) 2011, Universite de Montreal"
......@@ -1551,7 +1551,10 @@ class numeric_grad(object):
return (max_arg, max_pos, abs_errs[max_arg], rel_errs[max_arg])
def mode_not_debug(mode):
def mode_not_slow(mode):
if mode == 'FAST_COMPILE':
return FAST_RUN
mode = get_mode(mode)
if isinstance(mode, DebugMode):
opt = mode.optimizer
return FAST_RUN.clone(optimizer=opt)
......@@ -1686,7 +1689,7 @@ def verify_grad(fun, pt, n_tests=2, rng=None, eps=None,
cost = theano.tensor.sum(t_r * o_output)
if no_debug_ref:
mode_for_cost = mode_not_debug(mode)
mode_for_cost = mode_not_slow(mode)
else:
mode_for_cost = mode
......
......@@ -199,25 +199,25 @@ class TestCorr3D(utt.InferShapeTester):
self.validate((1, 1, 6, 6, 6), (1, 1, 3, 3, 3), 1, subsample=(3, 3, 3))
def test_filter_dilation(self):
# Tests correlation where filter dilation != (1,1,1)
self.validate((3, 2, 7, 5, 5), (2, 2, 2, 3, 3), 'valid', filter_dilation=(2, 2, 2))
self.validate((3, 2, 14, 10, 10), (2, 2, 2, 3, 3), 'valid', filter_dilation=(3, 1, 1))
self.validate((1, 1, 14, 14, 14), (1, 1, 3, 3, 3), 'valid', filter_dilation=(2, 3, 3))
self.validate((3, 2, 7, 5, 5), (2, 2, 2, 3, 3), 'full', filter_dilation=(2, 2, 2))
self.validate((3, 2, 7, 5, 5), (2, 2, 2, 3, 3), 'full', filter_dilation=(3, 1, 1))
self.validate((1, 1, 6, 6, 6), (1, 1, 3, 3, 3), 'full', filter_dilation=(2, 3, 3))
self.validate((3, 2, 7, 5, 5), (2, 2, 2, 3, 3), 'half', filter_dilation=(2, 2, 2))
self.validate((3, 2, 7, 5, 5), (2, 2, 2, 3, 3), 'half', filter_dilation=(3, 1, 1))
self.validate((1, 1, 6, 6, 6), (1, 1, 3, 3, 3), 'half', filter_dilation=(2, 3, 3))
self.validate((3, 2, 7, 5, 5), (2, 2, 2, 3, 3), (1, 1, 1), filter_dilation=(2, 2, 2))
self.validate((3, 2, 7, 5, 5), (2, 2, 2, 3, 3), (2, 1, 1), filter_dilation=(2, 1, 1))
self.validate((1, 1, 6, 6, 6), (1, 1, 3, 3, 3), (1, 2, 1), filter_dilation=(1, 2, 1))
self.validate((1, 1, 6, 6, 6), (1, 1, 3, 3, 3), (1, 1, 2), filter_dilation=(1, 1, 2))
# Tests correlation where filter dilation != (1,1,1)
@parameterized.expand([
((3, 2, 7, 5, 5), (2, 2, 2, 3, 3), 'valid', (2, 2, 2)),
((3, 2, 14, 10, 10), (2, 2, 2, 3, 3), 'valid', (3, 1, 1)),
((1, 1, 14, 14, 14), (1, 1, 3, 3, 3), 'valid', (2, 3, 3)),
((3, 2, 7, 5, 5), (2, 2, 2, 3, 3), 'full', (2, 2, 2)),
((3, 2, 7, 5, 5), (2, 2, 2, 3, 3), 'full', (3, 1, 1)),
((1, 1, 6, 6, 6), (1, 1, 3, 3, 3), 'full', (2, 3, 3)),
((3, 2, 7, 5, 5), (2, 2, 2, 3, 3), 'half', (2, 2, 2)),
((3, 2, 7, 5, 5), (2, 2, 2, 3, 3), 'half', (3, 1, 1)),
((1, 1, 6, 6, 6), (1, 1, 3, 3, 3), 'half', (2, 3, 3)),
((3, 2, 7, 5, 5), (2, 2, 2, 3, 3), (1, 1, 1), (2, 2, 2)),
((3, 2, 7, 5, 5), (2, 2, 2, 3, 3), (2, 1, 1), (2, 1, 1)),
((1, 1, 6, 6, 6), (1, 1, 3, 3, 3), (1, 2, 1), (1, 2, 1)),
((1, 1, 6, 6, 6), (1, 1, 3, 3, 3), (1, 1, 2), (1, 1, 2))])
def test_filter_dilation(self, image_shape, filter_shape, border_mode, filter_dilation):
self.validate(image_shape, filter_shape, border_mode, filter_dilation=filter_dilation)
def test_filter_dilation_subsample(self):
self.validate((1, 1, 6, 6, 6), (1, 1, 3, 3, 3), 1, subsample=(3, 3, 3), filter_dilation=(2, 2, 2))
@parameterized.expand([('valid',), ('full',), ('half',), ((1, 1, 1),),
......
......@@ -2175,9 +2175,9 @@ BatchedDotTester = makeTester(
correct7=(rand(3, 5), rand(3, 5)),
correct8=(rand(3), rand(3)),
correct9=(rand(3, 5, 7, 11), rand(3)),
correct10=(rand(3, 7, 11, 5), rand(3, 5)),
correct11=(rand(3, 7, 11, 5), rand(3, 5, 13)),
correct12=(rand(3, 7, 11, 5), rand(3, 13, 5, 17)),
correct10=(rand(3, 2, 6, 5), rand(3, 5)),
correct11=(rand(3, 2, 6, 5), rand(3, 5, 7)),
correct12=(rand(3, 2, 6, 5), rand(3, 7, 5, 8)),
mixed1=(rand(3, 5).astype('float32'),
rand(3, 5, 7)),
mixed2=(rand(3, 5).astype('float64'),
......
from __future__ import absolute_import, print_function, division
from functools import partial
import numpy as np
......
......@@ -62,7 +62,6 @@ whitelist_flake8 = [
"tensor/tests/test_sort.py",
"tensor/tests/test_raw_random.py",
"tensor/tests/test_xlogx.py",
"tensor/tests/test_extra_ops.py",
"tensor/tests/test_slinalg.py",
"tensor/tests/test_blas_c.py",
"tensor/tests/test_blas_scipy.py",
......
......@@ -292,7 +292,8 @@ class test_RopLop(RopLop_checker):
sy, _ = theano.scan(lambda i, y, x, v:
(tensor.grad(y[i], x) * v).sum(),
sequences=tensor.arange(a_pooled.shape[0]),
non_sequences=[a_pooled, x, ex])
non_sequences=[a_pooled, x, ex],
mode=mode)
scan_f = function([], sy, on_unused_input='ignore', mode=mode)
v1 = rop_f()
v2 = scan_f()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论