def test_setitem_matrix_bad_ndim():
a = numpy.arange(27)
a.resize((3, 3, 3))
a = theano._asarray(a, dtype='float32')
_a = cuda_ndarray.CudaNdarray(a)
b = theano._asarray([7, 8], dtype='float32')
_b = cuda_ndarray.CudaNdarray(b)
try:
# attempt to assign the ndarray b with setitem
_a[:, :, 1] = _b
assert False
except ValueError:
# print e
assert True
# test direct transfert from numpy
try:
# attempt to assign the ndarray b with setitem
_a[1, :, :] = b
assert False
except ValueError:
# print e
assert True
评论列表
文章目录