用法:
mxnet.ndarray.from_dlpack(dlpack)
dlpack:(
PyCapsule
(
the pointer of DLManagedTensor
)
) - 输入数据由 dlpack 张量支持的 NDArray
参数:
返回:
返回类型:
返回由 dlpack 张量支持的 NDArray。
例子:
>>> x = mx.nd.ones((2,3)) >>> y = mx.nd.to_dlpack_for_read(x) >>> type(y) <class 'PyCapsule'> >>> z = mx.nd.from_dlpack(y) >>> type(z) <class 'mxnet.ndarray.ndarray.NDArray'> >>> z [[ 1. 1. 1.] [ 1. 1. 1.]] <NDArray 2x3 @cpu(0)>
>>> w = mx.nd.to_dlpack_for_write(x) >>> type(w) <class 'PyCapsule'> >>> u = mx.nd.from_dlpack(w) >>> u += 1 >>> x [[2. 2. 2.] [2. 2. 2.]] <NDArray 2x3 @cpu(0)>
相关用法
- Python mxnet.ndarray.ftrl_update用法及代码示例
- Python mxnet.ndarray.floor用法及代码示例
- Python mxnet.ndarray.flatten用法及代码示例
- Python mxnet.ndarray.flip用法及代码示例
- Python mxnet.ndarray.fix用法及代码示例
- Python mxnet.ndarray.full用法及代码示例
- Python mxnet.ndarray.op.uniform用法及代码示例
- Python mxnet.ndarray.op.sample_negative_binomial用法及代码示例
- Python mxnet.ndarray.NDArray.ndim用法及代码示例
- Python mxnet.ndarray.op.khatri_rao用法及代码示例
- Python mxnet.ndarray.op.unravel_index用法及代码示例
- Python mxnet.ndarray.contrib.group_adagrad_update用法及代码示例
- Python mxnet.ndarray.op.slice_like用法及代码示例
- Python mxnet.ndarray.sparse.trunc用法及代码示例
- Python mxnet.ndarray.op.L2Normalization用法及代码示例
- Python mxnet.ndarray.op.softmax_cross_entropy用法及代码示例
- Python mxnet.ndarray.where用法及代码示例
- Python mxnet.ndarray.NDArray.reshape用法及代码示例
- Python mxnet.ndarray.op.round用法及代码示例
- Python mxnet.ndarray.SliceChannel用法及代码示例
注:本文由纯净天空筛选整理自apache.org大神的英文原创作品 mxnet.ndarray.from_dlpack。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。