set_input
Module.set_input(name , input_data)
Sets the input data to the pre-allocated memory on host or device with the given tensor name and input data.
If the tensor data is stored on Houmo device, this method is only used for passing the intermediate computing result to the next module to avoid transmission between host and device.
Notes
This function can only be used with following data restrictions:
| Data Format | Device Type | Data Precision | Data Alignment Required |
|---|---|---|---|
| YUV420SP | CPU | fixed | NO |
| YUV422SP | CPU | fixed | NO |
| YUV444SP | CPU | fixed | NO |
| Non-image data | CPU | quantized fixed | NO |
| YUV420SP | HDPL | fixed | YES |
| YUV422SP | HDPL | fixed | YES |
| YUV444SP | HDPL | fixed | YES |
| Non-image data | HDPL | quantized fixed | YES |
For "quantized fixed" data precision type, you must quantize the model before calling this function.
Parameters:
-
name (str) -- The name of the input tensor.
-
input_data (Tensor or numpy.ndarray) -- The input tensor data. For non-image data, the input must be quantized.
Note
-
If the original tensor data in host memory is not stored in a contiguous layout, the tensor data will be copied automatically to contiguous host CPU memory.
-
This function should be called before
tcim_lite.runtime.Module.run().
Examples
See example in Module.