提交 c5baab47 authored 作者: Frederic's avatar Frederic

small test fix when scipy is not available.

上级 0b6e8f30
......@@ -198,17 +198,25 @@ def rebuild_collect_shared(outputs,
(store_into, update_d[store_into]))
# filter_variable ensure smooth conversion of cpu/gpu Types
update_val = store_into.type.filter_variable(update_val)
if update_val.type != store_into.type:
err_msg = ('an update must have the same type as the '
'original shared variable(dest, dest.type, '
'update_val, update_val.type)')
err_arg = (store_into,
store_into.type,
update_val,
update_val.type)
raise TypeError(err_msg, err_arg)
try:
update_val = store_into.type.filter_variable(update_val)
except TypeError, e:
err_msg = ('An update must have the same type as the'
' original shared variable (shared_var=%s,'
' shared_var.type=%s,'
' update_val=%s, update_val.type=%s).' % (
store_into,
store_into.type,
update_val,
update_val.type))
err_sug = ('If the difference is related to the broadcast pattern,'
' you can call the'
' tensor.unbroadcast(var, axis_to_unbroadcast[, ...])'
' function to remove broadcastable dimensions.')
raise TypeError(err_msg, err_sug)
assert update_val.type == store_into.type
update_d[store_into] = update_val
update_expr.append((store_into, update_val))
......
from nose.plugins.skip import SkipTest
import numpy
from theano import tensor, function
from theano.tests import unittest_tools as utt
from theano.sandbox.linalg.kron import Kron, kron
......@@ -9,6 +11,9 @@ try:
except ImportError:
imported_scipy = False
if not imported_scipy:
raise SkipTest('Kron Op need the scipy package to be installed')
class TestKron(utt.InferShapeTester):
......@@ -20,8 +25,6 @@ class TestKron(utt.InferShapeTester):
self.op = kron
def test_perform(self):
assert imported_scipy, (
"Scipy not available. Scipy is needed for TestKron")
x = tensor.dmatrix()
y = tensor.dmatrix()
f = function([x, y], kron(x, y))
......
from nose.plugins.skip import SkipTest
import numpy
try:
import scipy.sparse as sp
......
from nose.plugins.skip import SkipTest
import numpy
import theano.sparse
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论