Configuration
class MLEdgeModel.Configuration
The Configuration
type provides the ability to customize how edge models are created and executed on the local device.
Creating the Model Configuration
/// <summary>
/// Create a configuration
/// </summary>
Configuration ();
The Configuration
defines a trivial constructor.
Specifying the Compute Target
/// <summary>
/// Specify the compute target used for model predictions.
/// </summary>
ComputeTarget computeTarget { get; set; }
The computeTarget
is used to specify the compute target that will be used to accelerate model predictions:
Compute Target
/// <summary>
/// Compute target used for model predictions.
/// </summary>
enum ComputeTarget : int {
/// <summary>
/// Use the default compute target for the given platform.
/// </summary>
Default = 0,
/// <summary>
/// Use the CPU.
/// </summary>
CPU = 1 << 0,
/// <summary>
/// Use the GPU.
/// </summary>
GPU = 1 << 1,
/// <summary>
/// Use the neural processing unit.
/// </summary>
NPU = 1 << 2,
/// <summary>
/// Use all available compute targets including the CPU, GPU, and neural processing units.
/// </summary>
All = CPU | GPU | NPU,
}
Specifying the Compute Device
/// <summary>
/// Specify the compute device used for model predictions.
/// The native type of this pointer is platform-specific.
/// </summary>
IntPtr computeDevice { get; set; }
On systems with multiple GPU's, the model data allows for specifying the preferred compute device for accelerating model predictions.
The computeDevice
is exposed as an opaque pointer to a platform-specific type:
On iOS and macOS, this pointer is an
id<MTLDevice>
.On Windows, this pointer is an
ID3D12Device
.
Last updated
Was this helpful?