Converts the Tensor class on the host to the Image class on the host, or converts the Tensor class on the device to the Image class on the DVPP.
Only Atlas inference product and Atlas 800I A2 inference product support this API.
During the conversion, the width of Image is 16-pixel aligned upwards, and the height of Image is 2-pixel aligned upwards. The converted Image class object has a padding region.
The attributes width and height display the padded width and height of the converted Image class, and the attributes original_width and original_height display the original width and height of the image.
Example:
1 | tensor_to_image(tensor: Tensor, imageFormat: image_format) |
Parameter |
Type |
Description |
|---|---|---|
tensor |
Tensor |
Input tensor, which must meet the following requirements:
|
imageFormat |
image_format enumeration |
Specified image format, which must match the image format corresponding to the inputTensor data. |
Returns the corresponding Image object.