提交 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 @@
language: python
python:
- "2.6"
# - "2.7"
# - "3.2"
# command to install dependencies
before_install:
......@@ -20,25 +18,38 @@ before_install:
install:
# 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.
- conda create --yes -q -n py26 python=2.6 numpy=1.6 scipy=0.11 nose=1.1 pip
- source activate py26
- pip install pydot
- 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
- 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
- source activate pyenv
- if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install pydot; fi
- pip install . --no-deps --use-mirrors
# command to run tests
env:
- PART="theano/scan_module/"
- PART="theano/sandbox theano/sparse theano/scalar/ theano/tensor/nnet/"
- PART="theano/tensor/tests/test_basic.py theano/tensor/signal/ theano/compile/ theano/gof/ theano/misc/ theano/tests/ theano/compat"
- PART="-e test_basic.py theano/tensor/tests"
- PART="scan_module"
- PART="sandbox sparse scalar tensor/nnet"
- PART="tensor/tests/test_basic.py tensor/signal compile gof misc tests compat"
- 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:
- 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
- uname -a
- free -m
- df -h
- 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"
- theano-nose -v $PART
- theano-cache list
......
......@@ -275,8 +275,8 @@ def run_conv_nnet2(use_gpu): # pretend we are training LeNet for MNIST
lr = tensor.fscalar('lr')
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,
logical_hid_shape[1] / 2), shape_kern1[2:], n_kern1, n_batch, 1, 1)
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)
hid = tensor.tanh(conv_op(x, w0) + b0.dimshuffle((0, 'x', 'x')))
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,
conv_op = conv.ConvOp(shape_img[2:], shape_kern[2:], n_kern,
n_batch, 1, 1, verbose=verbose, version=version)
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)
ds_op = downsample.DownsampleFactorMax((2, 2), ignore_border=False)
......
......@@ -147,11 +147,12 @@ def test_transinv_to_invtrans():
Y = tensor.nlinalg.matrix_inverse(X)
Z = Y.transpose()
f = theano.function([X], Z)
for node in f.maker.fgraph.toposort():
if isinstance(node.op, MatrixInverse):
assert isinstance(node.inputs[0].owner.op, DimShuffle)
if isinstance(node.op, DimShuffle):
assert node.inputs[0].name == 'X'
if config.mode != 'FAST_COMPILE':
for node in f.maker.fgraph.toposort():
if isinstance(node.op, MatrixInverse):
assert isinstance(node.inputs[0].owner.op, DimShuffle)
if isinstance(node.op, DimShuffle):
assert node.inputs[0].name == 'X'
def test_tag_solve_triangular():
......@@ -164,13 +165,12 @@ def test_tag_solve_triangular():
b1 = solve(L, x)
b2 = solve(U, x)
f = theano.function([A,x], b1)
for node in f.maker.fgraph.toposort():
if isinstance(node.op, Solve):
assert node.op.A_structure == 'lower_triangular'
if config.mode != 'FAST_COMPILE':
for node in f.maker.fgraph.toposort():
if isinstance(node.op, Solve):
assert node.op.A_structure == 'lower_triangular'
f = theano.function([A,x], b2)
for node in f.maker.fgraph.toposort():
if isinstance(node.op, Solve):
assert node.op.A_structure == 'upper_triangular'
if config.mode != 'FAST_COMPILE':
for node in f.maker.fgraph.toposort():
if isinstance(node.op, Solve):
assert node.op.A_structure == 'upper_triangular'
......@@ -470,10 +470,10 @@ class PushOutSeqScan(gof.Optimizer):
outside_ins = replace_with_out[to_replace.index(x)]
new_ord = (0,)
for old_ord in nd.op.new_order:
if isinstance(old_ord, int):
new_ord += (old_ord + 1,)
else:
if (old_ord == 'x'):
new_ord += (old_ord,)
else:
new_ord += (old_ord + 1,)
new_outer = outside_ins.dimshuffle(new_ord)
y = nd.outputs[0]
y_place_holder = scan_utils.safe_new(y, '_replace')
......
......@@ -202,11 +202,11 @@ class TestPushOutScanOutputDot(object):
# Compile the function twice, once with the optimization and once
# 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()
default_mode.excluding("scanOp_pushout_output")
f_no_opt = theano.function([a, b], outputs, mode=default_mode)
no_opt_mode = mode.excluding("scanOp_pushout_output")
f_no_opt = theano.function([a, b], outputs, mode=no_opt_mode)
# Ensure that the optimization was performed correctly in f_opt
# The inner function of scan should have only one output and it should
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论