Table of Contents

Class HardwareCostModel<T>

Namespace
AiDotNet.AutoML.NAS
Assembly
AiDotNet.dll

Models hardware costs for neural architecture search operations using FLOP-based estimation. Supports latency, energy, and memory cost estimation for different hardware platforms.

public class HardwareCostModel<T>

Type Parameters

T

The numeric type for calculations

Inheritance
HardwareCostModel<T>
Inherited Members

Constructors

HardwareCostModel(HardwarePlatform)

public HardwareCostModel(HardwarePlatform platform = HardwarePlatform.Mobile)

Parameters

platform HardwarePlatform

Properties

Characteristics

Gets the platform characteristics used for cost estimation.

public PlatformCharacteristics Characteristics { get; }

Property Value

PlatformCharacteristics

Platform

Gets the target hardware platform.

public HardwarePlatform Platform { get; }

Property Value

HardwarePlatform

Methods

CalculateOperationFlops(string, int, int, int)

Calculates the number of floating-point operations for a given operation.

public static double CalculateOperationFlops(string operation, int inputChannels, int outputChannels, int spatialSize)

Parameters

operation string
inputChannels int
outputChannels int
spatialSize int

Returns

double

CalculateOperationMemory(string, int, int, int)

Calculates the memory footprint (weights) for a given operation in bytes.

public static double CalculateOperationMemory(string operation, int inputChannels, int outputChannels, int spatialSize)

Parameters

operation string
inputChannels int
outputChannels int
spatialSize int

Returns

double

ClearCalibration()

Clears all calibration factors.

public void ClearCalibration()

EstimateArchitectureCost(Architecture<T>, int, int)

Estimates the total cost for an entire architecture.

public HardwareCost<T> EstimateArchitectureCost(Architecture<T> architecture, int inputChannels, int spatialSize)

Parameters

architecture Architecture<T>
inputChannels int
spatialSize int

Returns

HardwareCost<T>

EstimateOperationCost(string, int, int, int)

Estimates the hardware cost for a given operation using FLOP-based calculation.

public HardwareCost<T> EstimateOperationCost(string operation, int inputChannels, int outputChannels, int spatialSize)

Parameters

operation string
inputChannels int
outputChannels int
spatialSize int

Returns

HardwareCost<T>

GetCalibrationFactor(string)

Gets the calibration factor for an operation, or 1.0 if not set.

public double GetCalibrationFactor(string operation)

Parameters

operation string

Returns

double

GetCostBreakdown(Architecture<T>, int, int)

Gets a breakdown of costs per operation in the architecture.

public Dictionary<string, HardwareCost<T>> GetCostBreakdown(Architecture<T> architecture, int inputChannels, int spatialSize)

Parameters

architecture Architecture<T>
inputChannels int
spatialSize int

Returns

Dictionary<string, HardwareCost<T>>

GetTotalFlops(Architecture<T>, int, int)

Calculates total FLOPs for an architecture.

public double GetTotalFlops(Architecture<T> architecture, int inputChannels, int spatialSize)

Parameters

architecture Architecture<T>
inputChannels int
spatialSize int

Returns

double

GetTotalParameters(Architecture<T>, int)

Calculates total parameters (weights) for an architecture.

public double GetTotalParameters(Architecture<T> architecture, int inputChannels)

Parameters

architecture Architecture<T>
inputChannels int

Returns

double

MeetsConstraints(Architecture<T>, HardwareConstraints<T>, int, int)

Checks if an architecture meets the hardware constraints.

public bool MeetsConstraints(Architecture<T> architecture, HardwareConstraints<T> constraints, int inputChannels, int spatialSize)

Parameters

architecture Architecture<T>
constraints HardwareConstraints<T>
inputChannels int
spatialSize int

Returns

bool

SetCalibrationFactor(string, double)

Sets a calibration factor for a specific operation based on actual measurements.

public void SetCalibrationFactor(string operation, double factor)

Parameters

operation string

The operation name

factor double

The calibration factor (1.0 = no adjustment)