get_output

Module.get_output(name, device: Device = Device.CPU)

Gets output data from pre-allocated memory on host or Houmo device with the given tensor name.

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.

  • Before calling this function, you must pre-allocate the tensor parameter by creating a Tensor object.

  • The pre-allocated tensor must match the model's output tensor in format, data type, and shape, as retrieved via tcim_lite.runtime.Module.get_output_info(). This ensures that the output data can be correctly stored.

  • This function should be called after tcim_lite.runtime.Module.run() and tcim_lite.runtime.Module.sync().

Parameters:
  • name (str) -- The name of the output tensor.

  • device (Device) -- The device type on which the output data is stored.

Returns:

output_data -- The output data of the model inference.

Return type:

Numpy array

Examples

See example in Module.