FBNet<T>

Models & Types · AiDotNet.AutoML.NAS

FBNet: Hardware-Aware Efficient ConvNet Design via Differentiable Neural Architecture Search. Uses Gumbel-Softmax with hardware latency constraints to find efficient architectures optimized for specific target devices.

Reference: “FBNet: Hardware-Aware Efficient ConvNet Design via Differentiable NAS” (CVPR 2019)

Inheritance: AutoMLModelBase<T, Tensor<T>, Tensor<T>> → NasAutoMLModelBase<T> → FBNet<T>

For Beginners

FBNet (Facebook Net) finds architectures that are both accurate and fast on specific hardware. It uses differentiable search with real hardware latency measurements as constraints. Think of it as an architect who designs buildings that are both beautiful and structurally efficient for a specific site, rather than designing in the abstract.

Example

var searchSpace = new SearchSpaceBase<float>();
var fbnet = new FBNet<float>(searchSpace, targetPlatform: HardwarePlatform.Mobile);
Architecture<float> architecture = fbnet.DeriveArchitecture();

Constructors

Constructor Summary
FBNet(SearchSpaceBase<T> searchSpace, int numLayers, HardwarePlatform targetPlatform, double latencyWeight, double initialTemperature, int inputChannels, int spatialSize)

Properties

Property Summary
double LatencyExponent { get; set; } Gets or sets the exponent beta of the latency term in the FBNet loss CE * alpha * log(LAT)^beta (default 0.6, the paper’s value).

Methods

Method Summary
Architecture<T> DeriveArchitecture() Derives the discrete architecture by selecting the operation with highest probability
HardwareCost<T> GetArchitectureCost() Gets the final architecture’s hardware cost breakdown
List<Vector<T>> GetArchitectureGradients() Gets architecture gradients
List<Vector<T>> GetArchitectureParameters() Gets architecture parameters for optimization
T ComputeExpectedLatency() Computes the expected latency cost for the entire architecture
T ComputeTotalLoss(T taskLoss) Computes the FBNet loss CE * alpha * log(LAT)^beta (Wu et al.
T GetTemperature() Gets current temperature
Vector<T> GumbelSoftmax(Vector<T> theta, bool hard) Applies Gumbel-Softmax to layer-wise architecture parameters
bool MeetsConstraints() Checks if the derived architecture meets hardware constraints
void AnnealTemperature(int currentEpoch, int maxEpochs) Anneals the temperature during training
void SetConstraints(HardwareConstraints<T> constraints) Sets hardware constraints for the search