Rate this Page

Function torch::stable::sum_out#

Function Documentation#

inline torch::stable::Tensor &torch::stable::sum_out(torch::stable::Tensor &out, 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.IntList_out op.

Computes the sum of the input tensor along the specified dimensions, storing the result in the provided output tensor. Following C++ convention, the out parameter comes first.

Minimum compatible version: PyTorch 2.10.

Parameters:
  • out – The output tensor (modified in-place).

  • self – The input tensor.

  • dim – Optional dimensions to reduce.

  • keepdim – Whether to retain the reduced dimensions. Defaults to false.

  • dtype – Optional output dtype.

Returns:

Reference to the output tensor.