//! Error types for Neural Architecture Search use thiserror::Error; /// Error types for NAS operations #[derive(Error, Debug, Clone)] pub enum NASError { /// Tensor operation error #[error("Tensor operation error: {0}")] TensorError(String), /// Neural network error #[error("Neural network error: {0}")] NNError(String), /// Invalid architecture configuration #[error("Invalid architecture: {0}")] InvalidArchitecture(String), /// Invalid search space configuration #[error("Invalid search space: {0}")] InvalidSearchSpace(String), /// Invalid algorithm configuration #[error("Invalid algorithm config: {0}")] InvalidConfig(String), /// Search space encoding/decoding error #[error("Encoding error: {0}")] EncodingError(String), /// Insufficient data for operation #[error("Insufficient data: required {required}, available {available}")] InsufficientData { /// Required amount required: usize, /// Available amount available: usize, }, /// Operation error #[error("Operation error: {0}")] OperationError(String), /// Hardware profiling or device error #[error("Hardware error: {0}")] HardwareError(String), /// Latency prediction error #[error("Latency prediction error: {0}")] LatencyError(String), /// Multi-objective optimization error #[error("Objective error: {0}")] ObjectiveError(String), /// Fairness constraint error #[error("Fairness error: {0}")] FairnessError(String), /// Cost model computation error #[error("Cost model error: {0}")] CostModelError(String), } impl From for NASError { fn from(err: rtx_tensor::TensorError) -> Self { Self::TensorError(err.to_string()) } } impl From for NASError { fn from(err: rtx_nn::NNError) -> Self { Self::NNError(err.to_string()) } } /// Result type for NAS operations pub type Result = std::result::Result;