mirror of
https://github.com/ruvnet/RuView
synced 2026-07-31 18:51:42 +00:00
f49c722764
The Rust port lived two directories deep (rust-port/wifi-densepose-rs/) without any sibling under rust-port/ that warranted the extra level. Move the whole workspace up to v2/ to match v1/ (Python) at the same depth and shorten every cd / build command across the repo. git mv preserves history for all tracked files. 60 files updated for path references (CI workflows, ADRs, docs, scripts, READMEs, internal .claude-flow state). Two manual fixes for relative-cd paths in CLAUDE.md and ADR-043 that became wrong after the depth change (cd ../.. → cd ..). Validated: - cargo check --workspace --no-default-features → clean (after target/ nuke; the gitignored target/ was carried by the OS rename and had hard-coded old paths in build scripts) - cargo test --workspace --no-default-features → 1,539 passed, 0 failed, 8 ignored (same totals as pre-rename) - ESP32-S3 on COM7 → still streaming live CSI (cb #40300, RSSI -64 dBm) After-merge follow-up: contributors should `rm -rf v2/target` once and let cargo regenerate from the new path.
93 lines
2.3 KiB
Rust
93 lines
2.3 KiB
Rust
//! Error types for the neural network crate.
|
|
|
|
use thiserror::Error;
|
|
|
|
/// Result type alias for neural network operations
|
|
pub type NnResult<T> = Result<T, NnError>;
|
|
|
|
/// Neural network errors
|
|
#[derive(Error, Debug)]
|
|
pub enum NnError {
|
|
/// Configuration validation error
|
|
#[error("Configuration error: {0}")]
|
|
Config(String),
|
|
|
|
/// Model loading error
|
|
#[error("Failed to load model: {0}")]
|
|
ModelLoad(String),
|
|
|
|
/// Inference error
|
|
#[error("Inference failed: {0}")]
|
|
Inference(String),
|
|
|
|
/// Shape mismatch error
|
|
#[error("Shape mismatch: expected {expected:?}, got {actual:?}")]
|
|
ShapeMismatch {
|
|
/// Expected shape
|
|
expected: Vec<usize>,
|
|
/// Actual shape
|
|
actual: Vec<usize>,
|
|
},
|
|
|
|
/// Invalid input error
|
|
#[error("Invalid input: {0}")]
|
|
InvalidInput(String),
|
|
|
|
/// Backend not available
|
|
#[error("Backend not available: {0}")]
|
|
BackendUnavailable(String),
|
|
|
|
/// ONNX Runtime error
|
|
#[cfg(feature = "onnx")]
|
|
#[error("ONNX Runtime error: {0}")]
|
|
OnnxRuntime(#[from] ort::Error),
|
|
|
|
/// IO error
|
|
#[error("IO error: {0}")]
|
|
Io(#[from] std::io::Error),
|
|
|
|
/// Serialization error
|
|
#[error("Serialization error: {0}")]
|
|
Serialization(#[from] serde_json::Error),
|
|
|
|
/// Tensor operation error
|
|
#[error("Tensor operation error: {0}")]
|
|
TensorOp(String),
|
|
|
|
/// Unsupported operation
|
|
#[error("Unsupported operation: {0}")]
|
|
Unsupported(String),
|
|
}
|
|
|
|
impl NnError {
|
|
/// Create a configuration error
|
|
pub fn config<S: Into<String>>(msg: S) -> Self {
|
|
NnError::Config(msg.into())
|
|
}
|
|
|
|
/// Create a model load error
|
|
pub fn model_load<S: Into<String>>(msg: S) -> Self {
|
|
NnError::ModelLoad(msg.into())
|
|
}
|
|
|
|
/// Create an inference error
|
|
pub fn inference<S: Into<String>>(msg: S) -> Self {
|
|
NnError::Inference(msg.into())
|
|
}
|
|
|
|
/// Create a shape mismatch error
|
|
pub fn shape_mismatch(expected: Vec<usize>, actual: Vec<usize>) -> Self {
|
|
NnError::ShapeMismatch { expected, actual }
|
|
}
|
|
|
|
/// Create an invalid input error
|
|
pub fn invalid_input<S: Into<String>>(msg: S) -> Self {
|
|
NnError::InvalidInput(msg.into())
|
|
}
|
|
|
|
/// Create a tensor operation error
|
|
pub fn tensor_op<S: Into<String>>(msg: S) -> Self {
|
|
NnError::TensorOp(msg.into())
|
|
}
|
|
}
|