用法:
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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。