Download rust/tensor-hw/src/error.rs from Snapkitty/sparse-router-formal: direct link, hf CLI and curl.
- Browser
- Download file 2.32 kB
-
https://huggingface.co/Snapkitty/sparse-router-formal/resolve/main/rust/tensor-hw/src/error.rs
- Command line
-
hf download hf://Snapkitty/sparse-router-formal/rust/tensor-hw/src/error.rs
-
curl -L -o error.rs https://huggingface.co/Snapkitty/sparse-router-formal/resolve/main/rust/tensor-hw/src/error.rs
2.32 kB
| // SPDX-License-Identifier: LicenseRef-Sovereign-Leviathan-SL-AGPL3-001 | |
| // Licensing: see LICENSE in the repository root. | |
| //! Error types for hardware tensor layer | |
| use thiserror::Error; | |
| /// Hardware tensor operation result type | |
| pub type Result<T> = std::result::Result<T, HardwareError>; | |
| /// Fail-closed errors for tensor hardware operations | |
| pub enum HardwareError { | |
| /// Rank mismatch (expected, actual) | |
| RankMismatch { expected: usize, actual: usize }, | |
| /// Shape contains zero dimension | |
| ZeroElementShape, | |
| /// Buffer not found in registry | |
| BufferNotFound(u64), | |
| /// Generation counter mismatch (use-after-free detection) | |
| StaleGeneration { buffer_id: u64, expected: u64, actual: u64 }, | |
| /// Index out of bounds | |
| IndexOutOfBounds { index: usize, size: usize }, | |
| /// Computed memory address out of tensor bounds | |
| AddressOutOfBounds { address: usize, capacity: usize }, | |
| /// Shared tensor cannot be mutated | |
| SharedTensorMutation, | |
| /// Invalid stride configuration | |
| InvalidStride { dim: usize }, | |
| /// Materialization failed | |
| MaterializationFailed { reason: &'static str }, | |
| /// Governance state violation | |
| GovernanceViolation { reason: &'static str }, | |
| /// Ownership invariant violated | |
| OwnershipViolation { reason: &'static str }, | |
| /// View creation failed | |
| ViewCreationFailed { reason: &'static str }, | |
| /// Allocation failed | |
| AllocationFailed { size: usize }, | |
| } | |