Class WorkerFactory
Provides methods for instantiating workers and ops on given back ends.
Inherited Members
Namespace: Unity.Sentis
Assembly: Unity.Sentis.dll
Syntax
public class WorkerFactory
Methods
CreateBackend(BackendType)
Initializes and returns an instance of IBackend
for a backend type..
Declaration
public static IBackend CreateBackend(BackendType backendType)
Parameters
Type | Name | Description |
---|---|---|
BackendType | backendType | The type of backend to use. |
Returns
Type | Description |
---|---|
IBackend | The created |
CreateWorker(BackendType, Model)
Initializes and returns an instance of IWorker
on a given back end with a model
to execute.
Declaration
public static IWorker CreateWorker(BackendType backendType, Model model)
Parameters
Type | Name | Description |
---|---|---|
BackendType | backendType | The type of backend to use. |
Model | model | The model to execute with this |
Returns
Type | Description |
---|---|
IWorker | The created |
CreateWorker(BackendType, Model, WorkerConfiguration)
Initializes and returns an instance of IWorker
on a given back end with a model
to execute and workerConfiguration
.
Declaration
public static IWorker CreateWorker(BackendType backendType, Model model, WorkerFactory.WorkerConfiguration workerConfiguration)
Parameters
Type | Name | Description |
---|---|---|
BackendType | backendType | The type of backend to use. |
Model | model | The model to execute with this |
WorkerFactory.WorkerConfiguration | workerConfiguration | The worker configuration to use when executing. |
Returns
Type | Description |
---|---|
IWorker | The created |
CreateWorker(Model, DeviceType)
Initializes and returns an instance of IWorker
on a given device with a model
to execute. Sentis selects the best backend type available for deviceType
.
Declaration
public static IWorker CreateWorker(Model model, DeviceType deviceType)
Parameters
Type | Name | Description |
---|---|---|
Model | model | The model to execute with this |
DeviceType | deviceType | The type of device to use. Sentis selects the best backend type available for |
Returns
Type | Description |
---|---|
IWorker | The created |
GetBestTypeForDevice(DeviceType)
Returns the best backend type for the given deviceType
.
Declaration
public static BackendType GetBestTypeForDevice(DeviceType deviceType)
Parameters
Type | Name | Description |
---|---|---|
DeviceType | deviceType | The device type. |
Returns
Type | Description |
---|---|
BackendType | The selected backend type for the device type. |
IsType(BackendType, DeviceType)
Checks if a backend type matches a device type. For example, IsType(BackendType.GPUCompute, DeviceType.GPU)
returns true
.
Declaration
public static bool IsType(BackendType backendType, DeviceType deviceType)
Parameters
Type | Name | Description |
---|---|---|
BackendType | backendType | The backend type to check. |
DeviceType | deviceType | The device type to check. |
Returns
Type | Description |
---|---|
bool | Whether the backend type matches the device type. |