@@ -226,7 +226,7 @@ def test_dump():
226
226
for X in (X_sparse , X_dense , X_sliced ):
227
227
for y in (y_sparse , y_dense , y_sliced ):
228
228
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 ]:
230
230
f = BytesIO ()
231
231
# we need to pass a comment to get the version info in;
232
232
# LibSVM doesn't grok comments so they're not put in by
@@ -237,13 +237,7 @@ def test_dump():
237
237
# when it is sparse
238
238
y = y .T
239
239
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" ,
247
241
zero_based = zero_based )
248
242
f .seek (0 )
249
243
@@ -263,21 +257,17 @@ def test_dump():
263
257
assert_array_equal (X2 .sorted_indices ().indices , X2 .indices )
264
258
265
259
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
270
260
271
261
if dtype == np .float32 :
272
262
# allow a rounding error at the last decimal place
273
263
assert_array_almost_equal (
274
- X_input_dense , X2_dense , 4 )
264
+ X_dense . astype ( dtype ) , X2_dense , 4 )
275
265
assert_array_almost_equal (
276
266
y_dense .astype (dtype ), y2 , 4 )
277
267
else :
278
268
# allow a rounding error at the last decimal place
279
269
assert_array_almost_equal (
280
- X_input_dense , X2_dense , 15 )
270
+ X_dense . astype ( dtype ) , X2_dense , 15 )
281
271
assert_array_almost_equal (
282
272
y_dense .astype (dtype ), y2 , 15 )
283
273
0 commit comments