Class WorkerFactory
  
Factory to create worker that executes specified model on a particular device  (GPU, CPU, etc) using particular backend.
See IWorker for usage of the worker itself.
 
Inheritance
WorkerFactory
 
Syntax
public class WorkerFactory
 
Methods
  
CreateComputeWorker(Model, Boolean)
Create a worker using the precompiled GPU backend for the given model.
model is the associated model. See ModelLoader.cs.
verbose will log scheduling of layers execution to the console (default == false).
 
Declaration
public static IWorker CreateComputeWorker(Model model, bool verbose = false)
 
Parameters
Returns
CreateReferenceComputeWorker(Model, Boolean)
Create a worker using the reference GPU backend for the given model.
model is the associated model. See ModelLoader.cs.
verbose will log scheduling of layers execution to the console (default == false).
 
Declaration
public static IWorker CreateReferenceComputeWorker(Model model, bool verbose = false)
 
Parameters
Returns
CreateReferenceCPUWorker(Model, Boolean)
Create a worker using the reference CPU backend for the given model.
model is the associated model. See ModelLoader.cs.
verbose will log scheduling of layers execution to the console (default == false).
 
Declaration
public static IWorker CreateReferenceCPUWorker(Model model, bool verbose = false)
 
Parameters
Returns
CreateWorker(Model, Boolean)
Create a worker that will execute model using the best backend that is available for a given device type.
model is the associated model. See ModelLoader.cs.
verbose will log scheduling of layers execution to the console.
 
Declaration
public static IWorker CreateWorker(Model model, bool verbose = false)
 
Parameters
Returns
CreateWorker(Model, String[], String[], WorkerFactory.Device, Boolean)
Create a worker that will execute model using the best backend that is available for a given device type.
model is the associated model. See ModelLoader.cs.
additionalOutputs are the additional outputs to track but not directly specified by the model.
trimOutputs are the outputs not discard even if they are specified by the model.
device is the device type to run worker on. For example WorkerFactory.Device.GPU specifies the fast GPU path.
verbose will log scheduling of layers execution to the console (default == false).
 
Declaration
public static IWorker CreateWorker(Model model, string[] additionalOutputs, string[] trimOutputs, WorkerFactory.Device device = WorkerFactory.Device.Auto, bool verbose = false)
 
Parameters
Returns
CreateWorker(Model, String[], WorkerFactory.Device, Boolean)
Create a worker that will execute model using the best backend that is available for a given device type.
model is the associated model. See ModelLoader.cs.
additionalOutputs are the additional outputs to track but not directly specified by the model.
device is the device type to run worker on. For example WorkerFactory.Device.GPU specifies the fast GPU path.
verbose will log scheduling of layers execution to the console (default == false).
 
Declaration
public static IWorker CreateWorker(Model model, string[] additionalOutputs, WorkerFactory.Device device = WorkerFactory.Device.Auto, bool verbose = false)
 
Parameters
Returns
CreateWorker(Model, WorkerFactory.Device, Boolean)
Create a worker that will execute model using the best backend that is available for a given device type.
model is the associated model. See ModelLoader.cs.
device is the preferred device for execution. For example WorkerFactory.Device.GPU specifies the fast GPU path.
verbose will log scheduling of layers execution to the console.
 
Declaration
public static IWorker CreateWorker(Model model, WorkerFactory.Device device, bool verbose = false)
 
Parameters
Returns
CreateWorker(WorkerFactory.Type, Model, Boolean)
Create a worker with explicitly specified backend type to execute the given model.
type is backend type to use. For example WorkerFactory.Type.Compute specifies the fast GPU path.
model is the associated model. See ModelLoader.cs.
verbose will log scheduling of layers execution to the console.
 
Declaration
public static IWorker CreateWorker(WorkerFactory.Type type, Model model, bool verbose)
 
Parameters
Returns
CreateWorker(WorkerFactory.Type, Model, Boolean, WorkerFactory.Type, CompareOpsUtils.LogLevel)
Create a worker with explicitly specified backend type to execute the given model.
type is backend type to use. For example WorkerFactory.Type.Compute specifies the fast GPU path.
model is the associated model. See ModelLoader.cs.
verbose will log scheduling of layers execution to the console.
compareAgainstType if different than type model will be run on those two backend and result of every layer will be compared, checking for divergence. Great for debugging, but very slow because of the sync needed.
differenceAsError if compareAgainstType is used difference will be reported as error is this is true or warning otherwise.
 
Declaration
public static IWorker CreateWorker(WorkerFactory.Type type, Model model, bool verbose, WorkerFactory.Type compareAgainstType, CompareOpsUtils.LogLevel differenceLogLevel = CompareOpsUtils.LogLevel.Warning)
 
Parameters
Returns
CreateWorker(WorkerFactory.Type, Model, String[], Boolean)
Create a worker with explicitly specified backend type to execute the given model.
type is backend type to use. For example WorkerFactory.Type.Compute specifies the fast GPU path.
model is the associated model. See ModelLoader.cs.
additionalOutputs are the additional outputs to track but not directly specified by the model.
verbose will log scheduling of layers execution to the console (default == false).
 
Declaration
public static IWorker CreateWorker(WorkerFactory.Type type, Model model, string[] additionalOutputs, bool verbose = false)
 
Parameters
Returns
CreateWorker(WorkerFactory.Type, Model, String[], String[], Boolean)
Create a worker with explicitly specified backend type to execute the given model.
type is backend type to use. For example WorkerFactory.Type.Compute specifies the fast GPU path.
model is the associated model. See ModelLoader.cs.
additionalOutputs are the additional outputs to track but not directly specified by the model.
trimOutputs are the outputs not discard even if they are specified by the model.
verbose will log scheduling of layers execution to the console (default == false).
 
Declaration
public static IWorker CreateWorker(WorkerFactory.Type type, Model model, string[] additionalOutputs = null, string[] trimOutputs = null, bool verbose = false)
 
Parameters
Returns
CreateWorker(WorkerFactory.Type, Model, String[], String[], Boolean, WorkerFactory.Type, CompareOpsUtils.LogLevel)
Create a worker with explicitly specified backend type to execute the given model.
type is backend type to use. For example WorkerFactory.Type.Compute specifies the fast GPU path.
model is the associated model. See ModelLoader.cs.
additionalOutputs are the additional outputs to track but not directly specified by the model.
trimOutputs are the outputs not discard even if they are specified by the model.
verbose will log scheduling of layers execution to the console.
compareAgainstType if different than type model will be run on those two backend and result of every layer will be compared, checking for divergence. Great for debugging, but very slow because of the sync needed.
differenceAsError if compareAgainstType is used difference will be reported as error is this is true or warning otherwise.
 
Declaration
public static IWorker CreateWorker(WorkerFactory.Type type, Model model, string[] additionalOutputs, string[] trimOutputs, bool verbose, WorkerFactory.Type compareAgainstType, CompareOpsUtils.LogLevel differenceLogLevel = CompareOpsUtils.LogLevel.Warning)
 
Parameters
Returns
CreateWorker(WorkerFactory.Type, Model, String[], String[], WorkerFactory.WorkerConfiguration)
Create a worker with explicitly specified backend type to execute the given model.
type is backend type to use. For example WorkerFactory.Type.Compute specifies the fast GPU path.
model is the associated model. See ModelLoader.cs.
additionalOutputs are the additional outputs to track but not directly specified by the model.
trimOutputs are the outputs not discard even if they are specified by the model.
workerConfiguration define configurations such as logging and comparison backend, see WorkerConfiguration API docs.
 
Declaration
public static IWorker CreateWorker(WorkerFactory.Type type, Model model, string[] additionalOutputs, string[] trimOutputs, WorkerFactory.WorkerConfiguration workerConfiguration)
 
Parameters
Returns
CreateWorker(WorkerFactory.Type, Model, WorkerFactory.WorkerConfiguration)
Create a worker with explicitly specified backend type to execute the given model.
type is backend type to use. For example WorkerFactory.Type.Compute specifies the fast GPU path.
model is the associated model. See ModelLoader.cs.
workerConfiguration define configurations such as logging and comparison backend, see WorkerConfiguration API docs.
 
Declaration
public static IWorker CreateWorker(WorkerFactory.Type type, Model model, WorkerFactory.WorkerConfiguration workerConfiguration)
 
Parameters
Returns
GetBestTypeForDevice(WorkerFactory.Device)
Returns the best backend type that can run on a device given the model.
 
Declaration
public static WorkerFactory.Type GetBestTypeForDevice(WorkerFactory.Device device)
 
Parameters
Returns
IsType(WorkerFactory.Type, WorkerFactory.Device)
Check if a backend is of a given type.
For example: IsType(Type.CSharpRef, Device.GPU) == true
 
Declaration
public static bool IsType(WorkerFactory.Type type, WorkerFactory.Device device)
 
Parameters
Returns
ValidateType(WorkerFactory.Type)
Validate if a backend of type is supported, otherwise return a fallback type.
 
Declaration
public static WorkerFactory.Type ValidateType(WorkerFactory.Type type)
 
Parameters
Returns