Read output from a model asynchronously
After you run a model, you can read the output from a model asynchronously. This avoids Sentis blocking the main thread while it waits for the model to finish running then downloads the output data to the CPU.
Follow these steps:
- Get a reference to the tensor output data using
PeekOutput
. - Use the
Tensor.AsyncReadbackRequest
method and provide a callback. - Sentis invokes the callback when the readback is complete. The boolean argument is
true
when readback was successful. - Use
Tensor.MakeReadable
to put the downloaded data into a readable state.
Refer to the AsyncReadback/AsyncReadbackCompute
example in the sample scripts for an example.