Interface IWorker
An interface that allows you to execute neural networks (models).
IWorker abstracts implementation details on different hardware devices such as the CPU and the GPU. IWorker lets you do the following:
- Specify inputs.
- Schedule the work.
- Get outputs.
Internally, IWorker translates the neural network from a Model into a set of operations, then sends the operations to the hardware device for asynchronous execution.
Use WorkerFactory.CreateWorker or Model.CreateWorker to create a new instance of a worker.
Inherited Members
Namespace: Unity.Sentis
Assembly: solution.dll
Syntax
public interface IWorker : IDisposableProperties
| Name | Description | 
|---|---|
| scheduleProgress | Returns the proportion of the model scheduled for execution since the last call to  Returns 0.0 after you call  The value increases each time you iterate on the  | 
Methods
| Name | Description | 
|---|---|
| Execute() | Schedules the execution of the model on the worker. This is non-blocking. | 
| Execute(IDictionary<string, Tensor>) | Sets multiple tensors as the inputs of the model and schedules execution of the model. This is non-blocking. | 
| Execute(Tensor) | Sets a tensor as the default input of the model and schedules the execution of the model on the worker. This is non-blocking. For models with more than one input this sets the first input. | 
| FlushSchedule(bool) | Schedules the execution of the part of the model that hasn't been scheduled yet. This is non-blocking. | 
| GetBackend() | Returns the backend used for execution. | 
| PeekOutput() | Returns a reference to the default output tensor. This is non-blocking. For models with more than one output this returns a reference to the first output tensor. The reference is valid only until you call  If you want to dispose of the worker but keep the tensor, use  | 
| PeekOutput(string) | Returns a reference to an output tensor with a given  The reference is valid only until you call  If you want to dispose of the worker but keep the tensor, use  | 
| PrepareForInput(IDictionary<string, TensorShape>) | Prepares the worker to execute the model using inputs of given shapes. | 
| SetInput(string, Tensor) | Sets a tensor as a named input of the model. | 
| SetInput(Tensor) | Sets a tensor as the default input of the model. For models with more than one input this sets the first input. | 
| StartManualSchedule() | Schedules the execution of the model one layer at a time. This is non-blocking. To schedule the execution of the next layer of the model, call  | 
| StartManualSchedule(IDictionary<string, Tensor>) | Sets multiple tensors as the inputs of the model and schedules execution of the model one layer at a time. This is non-blocking. To schedule execution of the next layer of the model, call  | 
| StartManualSchedule(Tensor) | Sets a tensor as the default input of the model and schedules execution of the model one layer at a time. This is non-blocking. For models with more than one input this sets the first input. To schedule execution of the next layer of the model, call  | 
| Summary() | Returns a summary of the execution of the model. |