Sum

Function Usage

Image processing algorithm, tensor Sum algorithm to sum up the number of channels, supporting float16, float32, and uint8 data types. Asynchronous calling is supported. The inplace operation is not supported.

Only Atlas inference product support this API.

The following conditions must be met:

Prototype

1
APP_ERROR Sum(const Tensor &src, Tensor &dst, AscendStream& stream = AscendStream::DefaultStream());

Parameters

Parameter

Input/Output

Description

src

Input

Tensor class, cardinal number, input tensor, supporting float16, float32, and uint8 data types.

dst

Output

Tensor class, output tensor, supporting float16, float32, and uint8 data types. An empty tensor can be passed. If dst is not an empty tensor, call Tensor.Malloc() to allocate memory in advance. If the shape of the input tensor is NHWC, the output shape is NC. If the shape of the input tensor is HWC, the output shape is C. For example, if the input tensor shape is [2, 16, 16, 3], the output tensor shape is [2,3].

stream

Input

AscendStream type. The default value is AscendStream::DefaultStream(). When the parameter value is the default value, the API calling is a synchronous operation. In other cases, the API calling is an asynchronous operation.

Response Parameters

Data Structure

Description

APP_ERROR

For details about the returned error codes, see APP_ERROR Description.