def test_op(self):
for format in sparse.sparse_formats:
for axis in self.possible_axis:
variable, data = sparse_random_inputs(format,
shape=(10, 10))
z = theano.sparse.sp_sum(variable[0], axis=axis)
if axis is None:
assert z.type.broadcastable == ()
else:
assert z.type.broadcastable == (False, )
f = theano.function(variable, self.op(variable[0], axis=axis))
tested = f(*data)
expected = data[0].todense().sum(axis).ravel()
utt.assert_allclose(expected, tested)
评论列表
文章目录