Skip to content

Commit

Permalink
remove fixed seed for test_sparse_ndarray/test_operator_gpu.test_spar…
Browse files Browse the repository at this point in the history
…se_nd_pickle (apache#12012)
  • Loading branch information
haojin2 authored and eric-haibin-lin committed Aug 4, 2018
1 parent ebd70e7 commit c345aef
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions tests/python/unittest/test_sparse_ndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,24 +514,22 @@ def test_sparse_nd_astype_copy():
assert (id(x) == id(y))


@with_seed(0)
@with_seed()
def test_sparse_nd_pickle():
repeat = 1
dim0 = 40
dim1 = 40
stypes = ['row_sparse', 'csr']
densities = [0, 0.5]
stype_dict = {'row_sparse': RowSparseNDArray, 'csr': CSRNDArray}
for _ in range(repeat):
shape = rand_shape_2d(dim0, dim1)
for stype in stypes:
for density in densities:
a, _ = rand_sparse_ndarray(shape, stype, density)
assert isinstance(a, stype_dict[stype])
data = pkl.dumps(a)
b = pkl.loads(data)
assert isinstance(b, stype_dict[stype])
assert same(a.asnumpy(), b.asnumpy())
shape = rand_shape_2d(dim0, dim1)
for stype in stypes:
for density in densities:
a, _ = rand_sparse_ndarray(shape, stype, density)
assert isinstance(a, stype_dict[stype])
data = pkl.dumps(a)
b = pkl.loads(data)
assert isinstance(b, stype_dict[stype])
assert same(a.asnumpy(), b.asnumpy())


# @kalyc: Getting rid of fixed seed as flakiness could not be reproduced
Expand Down

0 comments on commit c345aef

Please sign in to comment.