用法:
mxnet.ndarray.op.cast_storage(data=None, stype=_Null, out=None, name=None, **kwargs)
out:- 此函數的輸出。
NDArray 或 NDArray 列表
參數:
返回:
返回類型:
將張量存儲類型轉換為新類型。
當具有默認存儲類型的 NDArray 強製轉換為 csr 或 row_sparse 存儲時,結果是緊湊的,這意味著:
- 對於 csr,不會保留零值
- 對於row_sparse,將不保留全零的行切片
cast_storage
輸出的存儲類型取決於 stype 參數:- cast_storage(csr, ‘default’) = 默認
- cast_storage(row_sparse, ‘default’) = 默認
- cast_storage(默認,‘csr’)= csr
- cast_storage(默認,‘row_sparse’)=row_sparse
- cast_storage(csr, ‘csr’) = csr
- cast_storage(row_sparse, ‘row_sparse’) = row_sparse
例子:
dense = [[ 0., 1., 0.], [ 2., 0., 3.], [ 0., 0., 0.], [ 0., 0., 0.]] # cast to row_sparse storage type rsp = cast_storage(dense, 'row_sparse') rsp.indices = [0, 1] rsp.values = [[ 0., 1., 0.], [ 2., 0., 3.]] # cast to csr storage type csr = cast_storage(dense, 'csr') csr.indices = [1, 0, 2] csr.values = [ 1., 2., 3.] csr.indptr = [0, 1, 3, 3, 3]
相關用法
- Python mxnet.ndarray.op.cast用法及代碼示例
- Python mxnet.ndarray.op.concat用法及代碼示例
- Python mxnet.ndarray.op.cbrt用法及代碼示例
- Python mxnet.ndarray.op.clip用法及代碼示例
- Python mxnet.ndarray.op.choose_element_0index用法及代碼示例
- Python mxnet.ndarray.op.ceil用法及代碼示例
- Python mxnet.ndarray.op.uniform用法及代碼示例
- Python mxnet.ndarray.op.sample_negative_binomial用法及代碼示例
- Python mxnet.ndarray.op.khatri_rao用法及代碼示例
- Python mxnet.ndarray.op.unravel_index用法及代碼示例
- Python mxnet.ndarray.op.slice_like用法及代碼示例
- Python mxnet.ndarray.op.L2Normalization用法及代碼示例
- Python mxnet.ndarray.op.softmax_cross_entropy用法及代碼示例
- Python mxnet.ndarray.op.round用法及代碼示例
- Python mxnet.ndarray.op.diag用法及代碼示例
- Python mxnet.ndarray.op.linalg_det用法及代碼示例
- Python mxnet.ndarray.op.sample_uniform用法及代碼示例
- Python mxnet.ndarray.op.sort用法及代碼示例
- Python mxnet.ndarray.op.linalg_potrf用法及代碼示例
- Python mxnet.ndarray.op.linalg_potri用法及代碼示例
注:本文由純淨天空篩選整理自apache.org大神的英文原創作品 mxnet.ndarray.op.cast_storage。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。