Skip to main content

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 FormatDevice TypeData PrecisionData Alignment Required
YUV420SPCPUfixedNO
YUV422SPCPUfixedNO
YUV444SPCPUfixedNO
Non-image dataCPUquantized fixedNO
YUV420SPHDPLfixedYES
YUV422SPHDPLfixedYES
YUV444SPHDPLfixedYES
Non-image dataHDPLquantized fixedYES

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.