sponge.function.keepdims_sum

View Source On Gitee
sponge.function.keepdims_sum(x: Tensor, axis: Union[int, Tuple[int], List[int]] = ())[source]

Reduces a dimension to 1 by summing the elements in the dimension of x along the axis, and the dimensions of the output and input are the same.

Parameters
  • x (Tensor[Number]) – The input tensor. The dtype of the tensor to be reduced is number. \((N,*)\) where \(*\) means, any number of additional dimensions, its rank should be less than 8.

  • axis (Union[int, tuple(int), list(int)]) – The dimensions to reduce. Default: (), reduce all dimensions. Only constant value is allowed. Must be in the range [-rank(x), rank(x)).

Outputs:

Tensor, has the same dtype as the x.

Supported Platforms:

Ascend GPU CPU