提交 a3870bb2 authored 作者: Frédéric Bastien's avatar Frédéric Bastien

Merge pull request #2322 from lamblin/travis_py3

Run part of travis on Python 3
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
language: python language: python
python: python:
- "2.6" - "2.6"
# - "2.7"
# - "3.2"
# command to install dependencies # command to install dependencies
before_install: before_install:
...@@ -20,25 +18,38 @@ before_install: ...@@ -20,25 +18,38 @@ before_install:
install: install:
# We support scipy 0.7.2, but it is not available on conda. # We support scipy 0.7.2, but it is not available on conda.
# So we test with 0.11. Our internal buildbot have 0.7.2. # So we test with 0.11. Our internal buildbot have 0.7.2.
- conda create --yes -q -n py26 python=2.6 numpy=1.6 scipy=0.11 nose=1.1 pip - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then conda create --yes -q -n pyenv python=2.6 numpy=1.6 scipy=0.11 nose=1.1 pyparsing=1.5 pip; fi
- source activate py26 - if [[ $TRAVIS_PYTHON_VERSION == '3.3' ]]; then conda create --yes -q -n pyenv python=3.3 numpy=1.9.1 scipy=0.14.0 nose=1.3.4 pip; fi
- pip install pydot - source activate pyenv
- if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install pydot; fi
- pip install . --no-deps --use-mirrors - pip install . --no-deps --use-mirrors
# command to run tests # command to run tests
env: env:
- PART="theano/scan_module/" - PART="scan_module"
- PART="theano/sandbox theano/sparse theano/scalar/ theano/tensor/nnet/" - PART="sandbox sparse scalar tensor/nnet"
- PART="theano/tensor/tests/test_basic.py theano/tensor/signal/ theano/compile/ theano/gof/ theano/misc/ theano/tests/ theano/compat" - PART="tensor/tests/test_basic.py tensor/signal compile gof misc tests compat"
- PART="-e test_basic.py theano/tensor/tests" - PART="-e test_basic.py tensor/tests"
matrix:
# Explicitly add one part to be run with Python 3, and a complete run in FAST_COMPILE
include:
- python: "3.3"
env: PART="tensor/tests/test_basic.py tensor/signal compile gof misc tests compat"
- python: "2.6"
env: PART="." THEANO_FLAGS="mode=FAST_COMPILE"
script: script:
- export THEANO_FLAGS=blas.ldflags="-lblas -lgfortran",warn.ignore_bug_before=all,on_opt_error=raise,on_shape_error=raise - export THEANO_FLAGS=$THEANO_FLAGS,blas.ldflags="-lblas -lgfortran",warn.ignore_bug_before=all,on_opt_error=raise,on_shape_error=raise
- python --version - python --version
- uname -a - uname -a
- free -m - free -m
- df -h - df -h
- ulimit -a - ulimit -a
# Move out of Theano so the import will use the installed version
- cd ..
# Move to the path of the installed version
- cd $(python -c 'import theano; import os; print(os.path.split(theano.__file__)[0])')
- echo "$PART" - echo "$PART"
- theano-nose -v $PART - theano-nose -v $PART
- theano-cache list - theano-cache list
......
...@@ -275,8 +275,8 @@ def run_conv_nnet2(use_gpu): # pretend we are training LeNet for MNIST ...@@ -275,8 +275,8 @@ def run_conv_nnet2(use_gpu): # pretend we are training LeNet for MNIST
lr = tensor.fscalar('lr') lr = tensor.fscalar('lr')
conv_op = conv.ConvOp(shape_img[2:], shape_kern[2:], n_kern, n_batch, 1, 1) conv_op = conv.ConvOp(shape_img[2:], shape_kern[2:], n_kern, n_batch, 1, 1)
conv_op1 = conv.ConvOp((n_kern, logical_hid_shape[0] / 2, conv_op1 = conv.ConvOp((n_kern, logical_hid_shape[0] // 2,
logical_hid_shape[1] / 2), shape_kern1[2:], n_kern1, n_batch, 1, 1) logical_hid_shape[1] // 2), shape_kern1[2:], n_kern1, n_batch, 1, 1)
hid = tensor.tanh(conv_op(x, w0) + b0.dimshuffle((0, 'x', 'x'))) hid = tensor.tanh(conv_op(x, w0) + b0.dimshuffle((0, 'x', 'x')))
hid1 = tensor.tanh(conv_op1(hid[:, :, ::2, ::2], w1) + b1.dimshuffle(( hid1 = tensor.tanh(conv_op1(hid[:, :, ::2, ::2], w1) + b1.dimshuffle((
...@@ -366,7 +366,7 @@ def build_conv_nnet2_classif(use_gpu, isize, ksize, n_batch, ...@@ -366,7 +366,7 @@ def build_conv_nnet2_classif(use_gpu, isize, ksize, n_batch,
conv_op = conv.ConvOp(shape_img[2:], shape_kern[2:], n_kern, conv_op = conv.ConvOp(shape_img[2:], shape_kern[2:], n_kern,
n_batch, 1, 1, verbose=verbose, version=version) n_batch, 1, 1, verbose=verbose, version=version)
conv_op1 = conv.ConvOp( conv_op1 = conv.ConvOp(
(n_kern, logical_hid_shape[0] / 2, logical_hid_shape[1] / 2), (n_kern, logical_hid_shape[0] // 2, logical_hid_shape[1] // 2),
shape_kern1[2:], n_kern1, n_batch, 1, 1,verbose=verbose, version=version) shape_kern1[2:], n_kern1, n_batch, 1, 1,verbose=verbose, version=version)
ds_op = downsample.DownsampleFactorMax((2, 2), ignore_border=False) ds_op = downsample.DownsampleFactorMax((2, 2), ignore_border=False)
......
...@@ -147,11 +147,12 @@ def test_transinv_to_invtrans(): ...@@ -147,11 +147,12 @@ def test_transinv_to_invtrans():
Y = tensor.nlinalg.matrix_inverse(X) Y = tensor.nlinalg.matrix_inverse(X)
Z = Y.transpose() Z = Y.transpose()
f = theano.function([X], Z) f = theano.function([X], Z)
for node in f.maker.fgraph.toposort(): if config.mode != 'FAST_COMPILE':
if isinstance(node.op, MatrixInverse): for node in f.maker.fgraph.toposort():
assert isinstance(node.inputs[0].owner.op, DimShuffle) if isinstance(node.op, MatrixInverse):
if isinstance(node.op, DimShuffle): assert isinstance(node.inputs[0].owner.op, DimShuffle)
assert node.inputs[0].name == 'X' if isinstance(node.op, DimShuffle):
assert node.inputs[0].name == 'X'
def test_tag_solve_triangular(): def test_tag_solve_triangular():
...@@ -164,13 +165,12 @@ def test_tag_solve_triangular(): ...@@ -164,13 +165,12 @@ def test_tag_solve_triangular():
b1 = solve(L, x) b1 = solve(L, x)
b2 = solve(U, x) b2 = solve(U, x)
f = theano.function([A,x], b1) f = theano.function([A,x], b1)
for node in f.maker.fgraph.toposort(): if config.mode != 'FAST_COMPILE':
if isinstance(node.op, Solve): for node in f.maker.fgraph.toposort():
assert node.op.A_structure == 'lower_triangular' if isinstance(node.op, Solve):
assert node.op.A_structure == 'lower_triangular'
f = theano.function([A,x], b2) f = theano.function([A,x], b2)
for node in f.maker.fgraph.toposort(): if config.mode != 'FAST_COMPILE':
if isinstance(node.op, Solve): for node in f.maker.fgraph.toposort():
assert node.op.A_structure == 'upper_triangular' if isinstance(node.op, Solve):
assert node.op.A_structure == 'upper_triangular'
...@@ -470,10 +470,10 @@ class PushOutSeqScan(gof.Optimizer): ...@@ -470,10 +470,10 @@ class PushOutSeqScan(gof.Optimizer):
outside_ins = replace_with_out[to_replace.index(x)] outside_ins = replace_with_out[to_replace.index(x)]
new_ord = (0,) new_ord = (0,)
for old_ord in nd.op.new_order: for old_ord in nd.op.new_order:
if isinstance(old_ord, int): if (old_ord == 'x'):
new_ord += (old_ord + 1,)
else:
new_ord += (old_ord,) new_ord += (old_ord,)
else:
new_ord += (old_ord + 1,)
new_outer = outside_ins.dimshuffle(new_ord) new_outer = outside_ins.dimshuffle(new_ord)
y = nd.outputs[0] y = nd.outputs[0]
y_place_holder = scan_utils.safe_new(y, '_replace') y_place_holder = scan_utils.safe_new(y, '_replace')
......
...@@ -202,11 +202,11 @@ class TestPushOutScanOutputDot(object): ...@@ -202,11 +202,11 @@ class TestPushOutScanOutputDot(object):
# Compile the function twice, once with the optimization and once # Compile the function twice, once with the optimization and once
# without # without
f_opt = theano.function([a, b], outputs) opt_mode = mode.including("scan")
f_opt = theano.function([a, b], outputs, mode=opt_mode)
default_mode = theano.compile.get_default_mode() no_opt_mode = mode.excluding("scanOp_pushout_output")
default_mode.excluding("scanOp_pushout_output") f_no_opt = theano.function([a, b], outputs, mode=no_opt_mode)
f_no_opt = theano.function([a, b], outputs, mode=default_mode)
# Ensure that the optimization was performed correctly in f_opt # Ensure that the optimization was performed correctly in f_opt
# The inner function of scan should have only one output and it should # The inner function of scan should have only one output and it should
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论