Vstack
Function Usage
Image processing algorithm, vertical stacking (Vstack) operation, supporting the float16, float32, and uint8 data type. Asynchronous calling and preloading are supported. See Example of the Preloading File of the Initialization Operator.
It is supported by the Atlas inference product and
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.
- Handle the issue of out-of-range data type if any.
- The input and output parameters cannot exceed four dimensions, and must match the tensor shapes (except the H dimension) and types.
- The total height of all input tensors must be less than or equal to the maximum height of the tensor type (maximum value of the uint32 type).
- If the output tensor is not empty, the height of the output tensor must be equal to the total height of all input tensors.
Prototype
1 | APP_ERROR Vstack(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 stacked. Tensors of the float16, float32, and uint8 types are supported, and the data memory must be on the device or DVPP side. HW (2-dimensional), HWC (3-dimensional), and NHWC (4-dimensional) are supported. The length of the tv tensor must be greater than 1 (at least two tensors must be passed). The length of the tv depends on the vector that can be successfully constructed. The sum of tensor height in tv cannot exceed the maximum height of the tensor class (maximum value of uint32). |
dst |
Output |
Tensor class, output tensor after stacking. The float16, float32, and uint8 types (consistent with tv) are supported. Empty tensors can be input. If dst is not empty, the shape must be the same as that of tv, and the H dimension (height) must be the sum of all tensor heights in tv. Call Tensor.Malloc() to allocate the memory in advance. The data memory must be on the device (the same device as tv) 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. |
Response Parameters
Data Structure |
Description |
|---|---|
APP_ERROR |
For details about the returned error codes, see APP_ERROR Description. |