提交 29b9bcc2 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Fix all the tests cases.

上级 1bc988ce
......@@ -491,26 +491,27 @@ class GpuAdvancedSubtensor(HideC, tensor.AdvancedSubtensor):
idx = inputs[1:]
# detect and transpose array indices
transp = list(range(x.ndim))
p = 0
pp = 0
nidx = []
nshp = list(x.shape)
for k, i in enumerate(idx):
if i is None:
nidx.append(slice(None))
nshp.insert(k, 1)
else:
nidx.append(i)
x = x.reshape(nshp)
transp = list(range(x.ndim))
p = 0
for k, i in enumerate(list(nidx)):
if (isinstance(i, numpy.ndarray) and
i.ndim != 0):
transp.remove(k)
transp.insert(p, k)
i = nidx.pop(k)
nidx.insert(p, i)
p += 1
else:
if i is None:
nidx.append(slice(None))
nshp.insert(pp, 1)
else:
nidx.append(i)
pp += 1
x = x.reshape(nshp)
x = x.transpose(*transp)
idx_ = ([slice(None)] * p + nidx[p:])
......
......@@ -41,7 +41,7 @@ class G_subtensor(test_subtensor.T_subtensor):
def test_advinc_subtensor1():
""" Test the second case in the opt local_gpu_advanced_incsubtensor1 """
# Test the second case in the opt local_gpu_advanced_incsubtensor1
for shp in [(3, 3), (3, 3, 3)]:
shared = gpuarray_shared_constructor
xval = numpy.arange(numpy.prod(shp), dtype='float32').reshape(shp) + 1
......@@ -110,7 +110,7 @@ class G_advancedsubtensor(test_subtensor.TestAdvancedSubtensor):
def test_adv_subtensor():
"""Test the advancedsubtensor on gpu."""
# Test the advancedsubtensor on gpu.
shp = (2, 3, 4)
shared = gpuarray_shared_constructor
xval = numpy.arange(numpy.prod(shp), dtype=theano.config.floatX).reshape(shp)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论