用法:
mxnet.ndarray.op.sum_axis(data=None, axis=_Null, keepdims=_Null, exclude=_Null, out=None, name=None, **kwargs)
- data:(
NDArray
) - 輸入 - axis:(
Shape
or
None
,
optional
,
default=None
) -沿其執行縮減的一個或多個軸。The default,
axis=()
, will compute over all elements into a scalar array with shape(1,)
.If
axis
is int, a reduction is performed on a particular axis.If
axis
is a tuple of ints, a reduction is performed on all the axes specified in the tuple.If
exclude
is true, reduction will be performed on the axes that are NOT in axis instead.Negative values means indexing from right to left.
- keepdims:(
boolean
,
optional
,
default=0
) - 如果設置為True
,縮減的軸作為尺寸為一的維度留在結果中。 - exclude:(
boolean
,
optional
,
default=0
) - 是否對不在軸上的軸執行縮減。 - out:(
NDArray
,
optional
) - 輸出 NDArray 來保存結果。
- data:(
out:- 此函數的輸出。
NDArray 或 NDArray 列表
參數:
返回:
返回類型:
計算給定軸上的數組元素的總和。
注意:
sum
和sum_axis
是等價的。對於 csr 存儲類型的 ndarray,支持沿軸 0 和軸 1 求和。將 keepdims 或 exclude 設置為 True 將導致回退到密集運算符。例子:
data = [[[1, 2], [2, 3], [1, 3]], [[1, 4], [4, 3], [5, 2]], [[7, 1], [7, 2], [7, 3]]] sum(data, axis=1) [[ 4. 8.] [ 10. 9.] [ 21. 6.]] sum(data, axis=[1,2]) [ 12. 19. 27.] data = [[1, 2, 0], [3, 0, 1], [4, 1, 0]] csr = cast_storage(data, 'csr') sum(csr, axis=0) [ 8. 3. 1.] sum(csr, axis=1) [ 3. 4. 5.]
相關用法
- Python mxnet.ndarray.op.sum用法及代碼示例
- Python mxnet.ndarray.op.sample_negative_binomial用法及代碼示例
- Python mxnet.ndarray.op.slice_like用法及代碼示例
- Python mxnet.ndarray.op.softmax_cross_entropy用法及代碼示例
- Python mxnet.ndarray.op.sample_uniform用法及代碼示例
- Python mxnet.ndarray.op.sort用法及代碼示例
- Python mxnet.ndarray.op.sample_gamma用法及代碼示例
- Python mxnet.ndarray.op.scatter_nd用法及代碼示例
- Python mxnet.ndarray.op.stack用法及代碼示例
- Python mxnet.ndarray.op.sign用法及代碼示例
- Python mxnet.ndarray.op.smooth_l1用法及代碼示例
- Python mxnet.ndarray.op.stop_gradient用法及代碼示例
- Python mxnet.ndarray.op.sample_exponential用法及代碼示例
- Python mxnet.ndarray.op.sgd_update用法及代碼示例
- Python mxnet.ndarray.op.sample_multinomial用法及代碼示例
- Python mxnet.ndarray.op.squeeze用法及代碼示例
- Python mxnet.ndarray.op.sample_normal用法及代碼示例
- Python mxnet.ndarray.op.space_to_depth用法及代碼示例
- Python mxnet.ndarray.op.slice_axis用法及代碼示例
- Python mxnet.ndarray.op.softmin用法及代碼示例
注:本文由純淨天空篩選整理自apache.org大神的英文原創作品 mxnet.ndarray.op.sum_axis。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。