mxpi_datatransfer
Function |
Transfers memory data between the device (Ascend AI Processor memory) and host (CPU memory). |
|---|---|
Synchronous/Asynchronous (Status) |
Asynchronous |
Constraints |
Only the MxpiVisionList and MxpiTensorPackageList data formats are supported. |
Plugin Base Class (Factory) |
mxpi_datatransfer |
Input/Output |
Static input: metadata (data types: MxpiVisionList and MxpiTensorPackageList) Static output: metadata (data types: MxpiVisionList and MxpiTensorPackageList) |
Property |
For details, see Table 1. |
Property Name |
Description |
Mandatory or Not |
Modifiable or Not |
|---|---|---|---|
dataSource |
Index of the input data (generally the name of the upstream element). Multiple indexes can be configured and separated by commas (,). The default value is the metadata key of the output port corresponding to the upstream plugin. |
No |
Yes |
transferMode |
Sets the data transfer mode:
|
No |
Yes |
removeSourceData |
Specifies whether to clear the memory of the input data.
|
No |
Yes |
By default, this plugin can be used only for single-branch stream services. Otherwise, data processing of other branches may be abnormal. In the multi-branch stream scenario, set removeSourceData to no.
Example
This plugin is used when external data is sent to the stream or data in the stream is sent out.

As shown in the preceding figure, you only need to resize the image by using the SDK. You can send the decoded data (host memory) to the stream. This plugin can be used to send the data to the device. The resizing plugin runs properly. After the output result is transferred by the plugin, the resized image data is transferred to the host. After obtaining the data, you can access the data on the host. As shown in the preceding figure, the SendProtobuf() and GetProtobuf() APIs are used to send data and receive results. For details, see Data Flow of SendProtobuf-GetProtobuf.