fuel-ir 0.20.61

Core types and traits for the fuel ML framework
Documentation
// SPDX-License-Identifier: MIT OR Apache-2.0
//! Core vocabulary types for the fuel ML framework.
//!
//! This crate contains the foundational types (`DType`, `Shape`, `Layout`, `Error`),
//! the backend capability **data** (`BackendCapabilities`, `SubstrateClass`,
//! `TransferPath`, `FitStatus`, `GgmlDType`, bundle `OutputView`s), and CPU
//! storage types (`HostBuffer`, `HostBufferRef`, `CpuDevice`) shared across all
//! fuel backend crates.
//!
//! The object-safe backend-contract **traits** (`DynBackendStorage`,
//! `DynBackendDevice`, `HostStorage`, `BackendStorage`, `BackendRuntime`,
//! `BackendCapabilityProvider`, `DynQuantizedStorage`, `QuantizedDeviceKernels`,
//! `InplaceOp1/2/3`) and the type-erased `Storage` handle live in the
//! `fuel-backend-contract` crate (above this crate, below the backends).

/// A small-vector type for dimension storage (sizes are non-negative).
/// Avoids heap allocation for tensors with up to 6 dimensions.
pub type DimVec = smallvec::SmallVec<[usize; 6]>;

/// A small-vector type for **signed** strides. Strides are signed
/// because metadata-only view ops can produce negative steps —
/// `Op::Flip` reverses iteration along a dim by negating that dim's
/// stride and adjusting `start_offset`, with zero kernel work. Most
/// strides are positive in practice; the signed type widens the
/// representation to cover the negative-stride case without forcing
/// every kernel to allocate or convert.
pub type StrideVec = smallvec::SmallVec<[isize; 6]>;

pub mod backend;
pub mod capability;
pub mod conv;
mod cpu_storage;
mod device;
pub mod dispatch;
#[cfg(feature = "dlpack")]
pub mod dlpack;
pub mod dtype;
pub mod error;
pub mod layout;
pub mod op;
pub mod probe;
pub mod quant_scale;
pub mod quantized;
pub mod scalar;
pub mod shape;
pub mod storage;
pub mod storage_status;
pub mod strided_index;
pub mod stype;
pub mod symbol;
pub mod token_kind;

pub use capability::Capability;
pub use cpu_storage::{CpuDevice, CpuStorage, CpuStorageRef, HostBuffer, HostBufferRef, HostDType};
pub use device::DeviceLocation;
pub use dtype::{
    DType, DTypeParseError, FloatDType, IntDType, RESERVED_DTYPE_TOKENS, WithDType,
    is_reserved_dtype_token,
};
pub use error::{Context, Error, Result};
pub use layout::Layout;
pub use probe::{BackendId, BackendProbe, DeviceDescriptor, EquivalenceKey};
pub use quant_scale::{ScaleGranularity, ScalePair};
pub use quantized::GgmlDType;
pub use scalar::Scalar;
pub use shape::{D, Dim, Dims, Shape, ShapeWithOneHole};
pub use storage_status::StorageStatus;
pub use strided_index::{StridedBlocks, StridedIndex};
pub use stype::{Encoding, SType, ScaleSpec};
pub use symbol::{DynScalar, SymEnv, SymGen, SymId};
pub use token_kind::{
    RECOGNIZED_UNSUPPORTED_DTYPE_TOKENS, SK4_DTYPE_TOKENS, TokenKind, classify_dtype_token,
    sk4_token,
};