Table Of Contents
Table Of Contents


RowSparseNDArray.astype(dtype, copy=True)

Returns a copy of the array after casting to a specified type. :param dtype: The type of the returned array. :type dtype: numpy.dtype or str :param copy: Default True. By default, astype always returns a newly

allocated ndarray on the same context. If this is set to False, and the dtype requested is the same as the ndarray’s dtype, the ndarray is returned instead of a copy.


>>> x = mx.nd.sparse.zeros('row_sparse', (2,3), dtype='float32')
>>> y = x.astype('int32')
>>> y.dtype
<type 'numpy.int32'>