axonml_core/
lib.rs

1//! Axonml Core - Foundation Layer for the Axonml ML Framework
2//!
3//! This crate provides the core abstractions that underpin the entire Axonml
4//! machine learning framework. It handles device management, memory storage,
5//! data types, and backend implementations.
6//!
7//! # Key Features
8//! - Device abstraction (CPU, CUDA, Vulkan, Metal, WebGPU)
9//! - Type-safe data type system (f32, f64, f16, i32, i64, bool)
10//! - Efficient memory storage with reference counting
11//! - Pluggable backend architecture
12//!
13//! # Example
14//! ```rust
15//! use axonml_core::{Device, DType, Storage};
16//!
17//! let device = Device::Cpu;
18//! let storage = Storage::<f32>::zeros(1024, device);
19//! ```
20//!
21//! @version 0.1.0
22//! @author `AutomataNexus` Development Team
23
24#![cfg_attr(not(feature = "std"), no_std)]
25#![warn(missing_docs)]
26#![warn(clippy::all)]
27#![warn(clippy::pedantic)]
28// ML/tensor-specific allowances
29#![allow(clippy::cast_possible_truncation)]
30#![allow(clippy::cast_sign_loss)]
31#![allow(clippy::cast_precision_loss)]
32#![allow(clippy::cast_possible_wrap)]
33#![allow(clippy::missing_errors_doc)]
34#![allow(clippy::missing_panics_doc)]
35#![allow(clippy::must_use_candidate)]
36#![allow(clippy::module_name_repetitions)]
37#![allow(clippy::similar_names)]
38#![allow(clippy::many_single_char_names)]
39#![allow(clippy::too_many_arguments)]
40#![allow(clippy::doc_markdown)]
41#![allow(clippy::cast_lossless)]
42#![allow(clippy::needless_pass_by_value)]
43#![allow(clippy::redundant_closure_for_method_calls)]
44#![allow(clippy::uninlined_format_args)]
45#![allow(clippy::ptr_arg)]
46#![allow(clippy::return_self_not_must_use)]
47#![allow(clippy::not_unsafe_ptr_arg_deref)]
48#![allow(clippy::items_after_statements)]
49#![allow(clippy::unreadable_literal)]
50#![allow(clippy::if_same_then_else)]
51#![allow(clippy::needless_range_loop)]
52#![allow(clippy::trivially_copy_pass_by_ref)]
53#![allow(clippy::unnecessary_wraps)]
54#![allow(clippy::match_same_arms)]
55#![allow(clippy::unused_self)]
56#![allow(clippy::too_many_lines)]
57#![allow(clippy::single_match_else)]
58#![allow(clippy::fn_params_excessive_bools)]
59#![allow(clippy::struct_excessive_bools)]
60#![allow(clippy::format_push_string)]
61#![allow(clippy::erasing_op)]
62#![allow(clippy::type_repetition_in_bounds)]
63#![allow(clippy::iter_without_into_iter)]
64#![allow(clippy::should_implement_trait)]
65#![allow(clippy::use_debug)]
66#![allow(clippy::case_sensitive_file_extension_comparisons)]
67#![allow(clippy::large_enum_variant)]
68#![allow(clippy::panic)]
69#![allow(clippy::struct_field_names)]
70#![allow(clippy::missing_fields_in_debug)]
71#![allow(clippy::upper_case_acronyms)]
72#![allow(clippy::assigning_clones)]
73#![allow(clippy::option_if_let_else)]
74#![allow(clippy::manual_let_else)]
75#![allow(clippy::explicit_iter_loop)]
76#![allow(clippy::default_trait_access)]
77#![allow(clippy::only_used_in_recursion)]
78#![allow(clippy::manual_clamp)]
79#![allow(clippy::ref_option)]
80#![allow(clippy::multiple_bound_locations)]
81#![allow(clippy::comparison_chain)]
82#![allow(clippy::manual_assert)]
83#![allow(clippy::unnecessary_debug_formatting)]
84
85// =============================================================================
86// Modules
87// =============================================================================
88
89pub mod allocator;
90pub mod backends;
91pub mod device;
92pub mod dtype;
93pub mod error;
94pub mod storage;
95
96// =============================================================================
97// Re-exports
98// =============================================================================
99
100pub use allocator::{Allocator, DefaultAllocator};
101pub use device::Device;
102pub use dtype::{DType, Float, Numeric, Scalar};
103pub use error::{Error, Result};
104pub use storage::Storage;
105
106// =============================================================================
107// Prelude
108// =============================================================================
109
110/// Convenient imports for common usage.
111pub mod prelude {
112    pub use crate::device::Device;
113    pub use crate::dtype::{DType, Float, Numeric, Scalar};
114    pub use crate::error::{Error, Result};
115    pub use crate::storage::Storage;
116}