Merge
Function Usage
Image channel merging API of the tensor class. It is used to merge multiple images into a multiple-channel image. Asynchronous calling is supported.
It is supported by the Atlas inference product and
For the
The following conditions must be met:
- The input and output tensors must be on the device or DVPP side, and the parameters (stream and data memory) must be on the same device.
- For synchronization, the device where the data memory is located must be the same as the initialized device.
- The input and output parameters cannot exceed four dimensions, and must match the tensor shapes (except the last dimension) and types.
Prototype
1 | APP_ERROR Merge(const std::vector <Tensor> &tv, Tensor &dst, AscendStream& stream = AscendStream::DefaultStream()); |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
tv |
Input |
std::vector <Tensor> class. It stores tensors to be merged. The tensor type can be the float16, float32, or uint8. HWC (three-dimensional) and NHWC (four-dimensional) are supported. The length of the tv vector must be greater than 1 (at least two tensors must be passed). |
dst |
Output |
Tensor class. The merged multi-channel tensor supports 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. The value of C in dst is 3 or 4, which is equal to the total number of C in tv. |
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. |