Class BackendFactory
The shipped way to reach an engine: GetEngine(BackendType) is Default, and GetEngine<T>() one cached instance per engine type.
public class BackendFactory
- Inheritance
-
BackendFactory
- Inherited Members
Remarks
New code names Default (the engine arrays bind when nothing else decides) or an array's TensorEngine (the engine it computes on) directly; this class stays for the callers that already use it.
Methods
GetEngine(BackendType)
The engine of a backend: for Default, the current Default (the built-in DefaultEngine until another engine is assigned there).
public static TensorEngine GetEngine(BackendType backendType = BackendType.Default)
Parameters
backendTypeBackendTypeThe backend; Default is the only one.
Returns
- TensorEngine
Default as it is at the call: an engine assigned there later is not this one, so hold the property rather than a value read from it once.
Exceptions
- ArgumentOutOfRangeException
backendTypeis not a BackendType member this method knows.
GetEngine<T>()
The one cached instance of the engine type T, created on first use with its
parameterless constructor.
public static TensorEngine GetEngine<T>() where T : TensorEngine, new()
Returns
- TensorEngine
The same instance on every call for the same
T. It is not Default unless assigned there: arrays bind it only when it is.
Type Parameters
TThe engine type.