Table of Contents

Class ProxylessNAS<T>

Namespace
AiDotNet.AutoML.NAS
Assembly
AiDotNet.dll

ProxylessNAS: Direct Neural Architecture Search on Target Task and Hardware. Uses path binarization and latency-aware loss to search directly on the target device without requiring a proxy task or separate hardware lookup tables.

Reference: "ProxylessNAS: Direct Neural Architecture Search on Target Task and Hardware" (ICLR 2019)

public class ProxylessNAS<T> : NasAutoMLModelBase<T>, IAutoMLModel<T, Tensor<T>, Tensor<T>>, IFullModel<T, Tensor<T>, Tensor<T>>, IModel<Tensor<T>, Tensor<T>, ModelMetadata<T>>, IModelSerializer, ICheckpointableModel, IParameterizable<T, Tensor<T>, Tensor<T>>, IFeatureAware, IFeatureImportance<T>, ICloneable<IFullModel<T, Tensor<T>, Tensor<T>>>, IGradientComputable<T, Tensor<T>, Tensor<T>>, IJitCompilable<T>

Type Parameters

T

The numeric type for calculations

Inheritance
AutoMLModelBase<T, Tensor<T>, Tensor<T>>
ProxylessNAS<T>
Implements
IAutoMLModel<T, Tensor<T>, Tensor<T>>
IFullModel<T, Tensor<T>, Tensor<T>>
IModel<Tensor<T>, Tensor<T>, ModelMetadata<T>>
IParameterizable<T, Tensor<T>, Tensor<T>>
ICloneable<IFullModel<T, Tensor<T>, Tensor<T>>>
IGradientComputable<T, Tensor<T>, Tensor<T>>
Inherited Members
Extension Methods

Constructors

ProxylessNAS(SearchSpaceBase<T>, int, HardwarePlatform, double, bool)

public ProxylessNAS(SearchSpaceBase<T> searchSpace, int numNodes = 4, HardwarePlatform targetPlatform = HardwarePlatform.Mobile, double latencyWeight = 0.1, bool useBinarization = true)

Parameters

searchSpace SearchSpaceBase<T>
numNodes int
targetPlatform HardwarePlatform
latencyWeight double
useBinarization bool

Properties

NasNumNodes

Gets the number of nodes to search over.

protected override int NasNumNodes { get; }

Property Value

int

NasSearchSpace

Gets the NAS search space.

protected override SearchSpaceBase<T> NasSearchSpace { get; }

Property Value

SearchSpaceBase<T>

NumOps

Gets the numeric operations provider for T.

protected override INumericOperations<T> NumOps { get; }

Property Value

INumericOperations<T>

Methods

BinarizePaths(Matrix<T>)

Applies path binarization for memory-efficient single-path sampling. Only one operation is active at a time during forward pass.

public Matrix<T> BinarizePaths(Matrix<T> alpha)

Parameters

alpha Matrix<T>

Returns

Matrix<T>

ComputeExpectedLatency(int, int)

Computes the expected latency cost of the architecture

public T ComputeExpectedLatency(int inputChannels, int spatialSize)

Parameters

inputChannels int
spatialSize int

Returns

T

ComputeTotalLoss(T, int, int)

Computes the total loss including task loss and latency regularization

public T ComputeTotalLoss(T taskLoss, int inputChannels, int spatialSize)

Parameters

taskLoss T
inputChannels int
spatialSize int

Returns

T

CreateInstanceForCopy()

Factory method for creating a new instance for deep copy. Derived classes must implement this to return a new instance of themselves. This ensures each copy has its own collections and lock object.

protected override AutoMLModelBase<T, Tensor<T>, Tensor<T>> CreateInstanceForCopy()

Returns

AutoMLModelBase<T, Tensor<T>, Tensor<T>>

A fresh instance of the derived class with default parameters

Remarks

When implementing this method, derived classes should create a fresh instance with default parameters, and should not attempt to preserve runtime or initialization state from the original instance. The deep copy logic will transfer relevant state (trial history, search space, etc.) after construction.

DeriveArchitecture()

Derives the final discrete architecture by selecting operations with highest weights

public Architecture<T> DeriveArchitecture()

Returns

Architecture<T>

EstimateArchitectureCost(int, int)

Estimates the final architecture's hardware cost

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

Parameters

inputChannels int
spatialSize int

Returns

HardwareCost<T>

GetArchitectureGradients()

Gets architecture gradients

public List<Matrix<T>> GetArchitectureGradients()

Returns

List<Matrix<T>>

GetArchitectureParameters()

Gets architecture parameters for optimization

public List<Matrix<T>> GetArchitectureParameters()

Returns

List<Matrix<T>>

SearchArchitecture(Tensor<T>, Tensor<T>, Tensor<T>, Tensor<T>, TimeSpan, CancellationToken)

Performs algorithm-specific architecture search.

protected override Architecture<T> SearchArchitecture(Tensor<T> inputs, Tensor<T> targets, Tensor<T> validationInputs, Tensor<T> validationTargets, TimeSpan timeLimit, CancellationToken cancellationToken)

Parameters

inputs Tensor<T>
targets Tensor<T>
validationInputs Tensor<T>
validationTargets Tensor<T>
timeLimit TimeSpan
cancellationToken CancellationToken

Returns

Architecture<T>

SetBinarizationTemperature(double)

Sets the binarization temperature

public void SetBinarizationTemperature(double temperature)

Parameters

temperature double