def test_local_dense_from_sparse_sparse_from_dense():
mode = theano.compile.mode.get_default_mode()
mode = mode.including("local_dense_from_sparse_sparse_from_dense")
m = theano.tensor.matrix()
for op in [theano.sparse.csr_from_dense, theano.sparse.csc_from_dense]:
s = op(m)
o = theano.sparse.dense_from_sparse(s)
f = theano.function([m], o, mode=mode)
# We should just have a deep copy.
assert len(f.maker.fgraph.apply_nodes) == 1
f([[1, 2], [3, 4]])
评论列表
文章目录