用法:
mxnet.ndarray.indexing_key_expand_implicit_axes(key, shape)
通过添加
slice(None)
使隐式轴显式,并通过nonzero
将布尔数组转换为整数数组。例子:
>>> shape = (3, 4, 5) >>> indexing_key_expand_implicit_axes(np.s_[2, 1, 1], shape) (2, 1, 1) >>> indexing_key_expand_implicit_axes(np.s_[0], shape) (0, slice(None, None, None), slice(None, None, None)) >>> indexing_key_expand_implicit_axes(np.s_[0, ...], shape) # equivalent (0, slice(None, None, None), slice(None, None, None)) >>> indexing_key_expand_implicit_axes(np.s_[:2, None, 0, ...], shape) (slice(None, 2, None), None, 0, slice(None, None, None)) >>> bool_array = np.array([[True, False, True, False], [False, True, False, True], [True, False, True, False]], dtype=np.bool) >>> indexing_key_expand_implicit_axes(np.s_[bool_array, None, 0:2], shape) (array([0, 0, 1, 1, 2, 2], dtype=int64), array([0, 2, 1, 3, 0, 2], dtype=int64), None, slice(None, 2, None))
相关用法
- 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用法及代码示例
- Python mxnet.ndarray.eye用法及代码示例
- Python mxnet.ndarray.sample_multinomial用法及代码示例
- Python mxnet.ndarray.op.diag用法及代码示例
- Python mxnet.ndarray.ones_like用法及代码示例
- Python mxnet.ndarray.linalg_gemm用法及代码示例
- Python mxnet.ndarray.stop_gradient用法及代码示例
注:本文由纯净天空筛选整理自apache.org大神的英文原创作品 mxnet.ndarray.indexing_key_expand_implicit_axes。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。