用法:
as_in_context(context)
context:(mxnet.context.Context) - 目標上下文。
目標數組。
參數:
返回:
返回類型:
在目標設備上返回一個與此數組具有相同值的數組。
如果目標上下文與
self.context
相同,則返回self
。否則,將製作一份副本。例子:
>>> x = mx.nd.ones((2,3)) >>> y = x.as_in_context(mx.cpu()) >>> y is x True >>> z = x.as_in_context(mx.gpu(0)) >>> z is x False
相關用法
- Python mxnet.ndarray.NDArray.astype用法及代碼示例
- Python mxnet.ndarray.NDArray.asscalar用法及代碼示例
- Python mxnet.ndarray.NDArray.asnumpy用法及代碼示例
- Python mxnet.ndarray.NDArray.ndim用法及代碼示例
- Python mxnet.ndarray.NDArray.reshape用法及代碼示例
- Python mxnet.ndarray.NDArray.ctx用法及代碼示例
- Python mxnet.ndarray.NDArray.size用法及代碼示例
- Python mxnet.ndarray.NDArray.copy用法及代碼示例
- Python mxnet.ndarray.NDArray.to_dlpack_for_write用法及代碼示例
- Python mxnet.ndarray.NDArray.shape用法及代碼示例
- Python mxnet.ndarray.NDArray.flatten用法及代碼示例
- Python mxnet.ndarray.NDArray.to_dlpack_for_read用法及代碼示例
- Python mxnet.ndarray.NDArray.slice_assign_scalar用法及代碼示例
- Python mxnet.ndarray.NDArray.slice_assign用法及代碼示例
- Python mxnet.ndarray.NDArray.broadcast_to用法及代碼示例
- Python mxnet.ndarray.NDArray.expand_dims用法及代碼示例
- Python mxnet.ndarray.NDArray.broadcast_like用法及代碼示例
- Python mxnet.ndarray.NDArray.copyto用法及代碼示例
- Python mxnet.ndarray.NDArray.dtype用法及代碼示例
- Python mxnet.ndarray.NDArray.T用法及代碼示例
注:本文由純淨天空篩選整理自apache.org大神的英文原創作品 mxnet.ndarray.NDArray.as_in_context。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。