Tensor weighted mixing API (dst = alpha × src1 + beta × src2 + gamma) of the image processing class. The float16, float32, and uint8 data types are supported. Asynchronous calling is supported. The inplace operation is not supported.
It is supported by the Atlas inference product and
For the
The following conditions must be met:
1 | APP_ERROR AddWeighted(const Tensor &src1, float alpha, const Tensor &src2, float beta, float gamma, Tensor &dst, AscendStream &stream = AscendStream::DefaultStream()); |
Parameter |
Input/Output |
Description |
|---|---|---|
src1 |
Input |
Tensor class, input tensor, supporting the float16, float32, and uint8 data types. The data memory must be on the device or DVPP side. |
alpha |
Input |
Float type. Coefficient of tensor src1. |
src2 |
Input |
Tensor class, input tensor, supporting the float16, float32, and uint8 data types. The data memory must be on the device or DVPP side. |
beta |
Input |
Float type. Coefficient of tensor src2. |
gamma |
Input |
Float type. It is used to calculate the sum of dst. |
dst |
Output |
Tensor class, output tensor, supporting the float16, float32, and uint8 data types. An empty tensor can be passed. If dst is not empty, the shape of dst must be the same as that of src1 or src2. Call Tensor.Malloc() to allocate memory in advance. The data memory must be on the device (the same device as that of src) or DVPP. |
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. |
Data Structure |
Description |
|---|---|
APP_ERROR |
For details about the returned error codes, see APP_ERROR Description. |