Function torch::stable::sum#
Defined in File ops.h
Function Documentation#
-
inline torch::stable::Tensor torch::stable::sum(const torch::stable::Tensor &self, std::optional<torch::headeronly::IntHeaderOnlyArrayRef> dim = std::nullopt, bool keepdim = false, std::optional<torch::headeronly::ScalarType> dtype = std::nullopt)#
Stable version of the sum.dim_IntList op.
Computes the sum of the input tensor along the specified dimensions. If dim is not provided, sums over all dimensions.
Minimum compatible version: PyTorch 2.10.
- Parameters:
self – The input tensor.
dim – Optional dimensions to reduce. If not provided, reduces all dimensions.
keepdim – Whether to retain the reduced dimensions. Defaults to false.
dtype – Optional output dtype. If not provided, uses the input dtype.
- Returns:
A tensor containing the sum.