提交 c14f867f authored 作者: Frederic Bastien's avatar Frederic Bastien

Fix test due to the new theano.shared() behavior

上级 482f2170
......@@ -351,7 +351,11 @@ class G_Join_and_Split(test_basic.T_Join_and_Split):
# this is to avoid errors with limited devices
self.floatX = 'float32'
self.hide_error = theano.config.mode not in ['DebugMode', 'DEBUG_MODE']
self.shared = gpuarray_shared_constructor
def shared(x, **kwargs):
return gpuarray_shared_constructor(x, target=test_ctx_name,
**kwargs)
self.shared = shared
def test_gpusplit_opt(self):
rng = np.random.RandomState(seed=utt.fetch_seed())
......
......@@ -11,7 +11,7 @@ from theano.tensor.blas import gemv_inplace, gemm_inplace, _dot22, batched_dot
from theano.tensor.tests.test_blas import TestGer, BaseGemv
from .. import gpuarray_shared_constructor
from .config import mode_with_gpu
from .config import mode_with_gpu, test_ctx_name
from .test_basic_ops import makeTester, rand
from ..blas import (gpugemv_inplace, gpugemv_no_inplace,
......@@ -48,7 +48,7 @@ def test_float16():
rand(3, 3).astype('float16'),
rand(3, 3).astype('float16'),
np.asarray(0.5, dtype=np.float32)]
float16_shared = [gpuarray_shared_constructor(val)
float16_shared = [gpuarray_shared_constructor(val, target=test_ctx_name)
for val in float16_data]
o = gpugemm_no_inplace(*float16_shared)
f = theano.function([], o)
......
......@@ -19,7 +19,7 @@ from ..subtensor import (GpuIncSubtensor, GpuSubtensor,
GpuAllocDiag)
from ..type import gpuarray_shared_constructor
from .config import mode_with_gpu
from .config import mode_with_gpu, test_ctx_name
class G_subtensor(test_subtensor.T_subtensor):
......@@ -27,9 +27,13 @@ class G_subtensor(test_subtensor.T_subtensor):
return None
def __init__(self, name):
def shared(x, **kwargs):
return gpuarray_shared_constructor(x, target=test_ctx_name,
**kwargs)
test_subtensor.T_subtensor.__init__(
self, name,
shared=gpuarray_shared_constructor,
shared=shared,
sub=GpuSubtensor,
inc_sub=GpuIncSubtensor,
adv_sub1=GpuAdvancedSubtensor1,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论