def test_sparse(): sparse = pytest.importorskip('sparse') from sparse.utils import assert_eq x = sparse.COO({(0, 0): 1, (1, 2): 2, (2, 1): 3}) y = x.todense() assert utils.sum(x) == utils.sum(x.todense()) for func in [utils.sigmoid, utils.sum, utils.exp]: assert_eq(func(x), func(y))
def test_sparse(): x = sparse.COO({(0, 0): 1, (1, 2): 2, (2, 1): 3}) y = x.todense() assert utils.sum(x) == utils.sum(x.todense()) for func in [utils.sigmoid, utils.sum, utils.exp]: assert (func(x) == func(y)).all()