def test_GetItemList(self):
a, A = sparse_random_inputs('csr', (4, 5))
b, B = sparse_random_inputs('csc', (4, 5))
y = a[0][[0, 1, 2, 3, 1]]
z = b[0][[0, 1, 2, 3, 1]]
fa = theano.function([a[0]], y)
fb = theano.function([b[0]], z)
t_geta = fa(A[0]).todense()
t_getb = fb(B[0]).todense()
s_geta = scipy.sparse.csr_matrix(A[0])[[0, 1, 2, 3, 1]].todense()
s_getb = scipy.sparse.csc_matrix(B[0])[[0, 1, 2, 3, 1]].todense()
utt.assert_allclose(t_geta, s_geta)
utt.assert_allclose(t_getb, s_getb)
评论列表
文章目录