Class HardwareCostModel<T>
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
TThe numeric type for calculations
- Inheritance
-
HardwareCostModel<T>
- Inherited Members
Constructors
HardwareCostModel(HardwarePlatform)
public HardwareCostModel(HardwarePlatform platform = HardwarePlatform.Mobile)
Parameters
platformHardwarePlatform
Properties
Characteristics
Gets the platform characteristics used for cost estimation.
public PlatformCharacteristics Characteristics { get; }
Property Value
Platform
Gets the target hardware platform.
public HardwarePlatform Platform { get; }
Property Value
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
Returns
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
Returns
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
architectureArchitecture<T>inputChannelsintspatialSizeint
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
Returns
- HardwareCost<T>
GetCalibrationFactor(string)
Gets the calibration factor for an operation, or 1.0 if not set.
public double GetCalibrationFactor(string operation)
Parameters
operationstring
Returns
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
architectureArchitecture<T>inputChannelsintspatialSizeint
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
architectureArchitecture<T>inputChannelsintspatialSizeint
Returns
GetTotalParameters(Architecture<T>, int)
Calculates total parameters (weights) for an architecture.
public double GetTotalParameters(Architecture<T> architecture, int inputChannels)
Parameters
architectureArchitecture<T>inputChannelsint
Returns
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
architectureArchitecture<T>constraintsHardwareConstraints<T>inputChannelsintspatialSizeint
Returns
SetCalibrationFactor(string, double)
Sets a calibration factor for a specific operation based on actual measurements.
public void SetCalibrationFactor(string operation, double factor)