8000 Revert "Fix test_svmlight_format.py::test_dump on ARM (#13263)" · xhluca/scikit-learn@376e011 · GitHub
[go: up one dir, main page]

Skip to content

Commit 376e011

Browse files
author
Xing
committed
Revert "Fix test_svmlight_format.py::test_dump on ARM (scikit-learn#13263)"
This reverts commit e8ec1dd.
1 parent e316760 commit 376e011

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

sklearn/datasets/tests/test_svmlight_format.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def test_dump():
226226
for X in (X_sparse, X_dense, X_sliced):
227227
for y in (y_sparse, y_dense, y_sliced):
228228
for zero_based in (True, False):
229-
for dtype in [np.float32, np.float64, np.int32, np.int64]:
229+
for dtype in [np.float32, np.float64, np.int32]:
230230
f = BytesIO()
231231
# we need to pass a comment to get the version info in;
232232
# LibSVM doesn't grok comments so they're not put in by
@@ -237,13 +237,7 @@ def test_dump():
237237
# when it is sparse
238238
y = y.T
239239

240-
# Note: with dtype=np.int32 we are performing unsafe casts,
241-
# where X.astype(dtype) overflows. The result is
242-
# then platform dependent and X_dense.astype(dtype) may be
243-
# different from X_sparse.astype(dtype).asarray().
244-
X_input = X.astype(dtype)
245-
246-
dump_svmlight_file(X_input, y, f, comment="test",
240+
dump_svmlight_file(X.astype(dtype), y, f, comment="test",
247241
zero_based=zero_based)
248242
f.seek(0)
249243

@@ -263,21 +257,17 @@ def test_dump():
263257
assert_array_equal(X2.sorted_indices().indices, X2.indices)
264258

265259
X2_dense = X2.toarray()
266-
if sp.issparse(X_input):
267-
X_input_dense = X_input.toarray()
268-
else:
269-
X_input_dense = X_input
270260

271261
if dtype == np.float32:
272262
# allow a rounding error at the last decimal place
273263
assert_array_almost_equal(
274-
X_input_dense, X2_dense, 4)
264+
X_dense.astype(dtype), X2_dense, 4)
275265
assert_array_almost_equal(
276266
y_dense.astype(dtype), y2, 4)
277267
else:
278268
# allow a rounding error at the last decimal place
279269
assert_array_almost_equal(
280-
X_input_dense, X2_dense, 15)
270+
X_dense.astype(dtype), X2_dense, 15)
281271
assert_array_almost_equal(
282272
y_dense.astype(dtype), y2, 15)
283273

0 commit comments

Comments
 (0)
0