Skip to main content

axonml_tensor/
lib.rs

1//! Axonml Tensor - N-Dimensional Array for Machine Learning
2//!
3//! # File
4//! `crates/axonml-tensor/src/lib.rs`
5//!
6//! # Author
7//! Andrew Jewell Sr - AutomataNexus
8//!
9//! # Updated
10//! March 8, 2026
11//!
12//! # Disclaimer
13//! Use at own risk. This software is provided "as is", without warranty of any
14//! kind, express or implied. The author and AutomataNexus shall not be held
15//! liable for any damages arising from the use of this software.
16
17#![cfg_attr(not(feature = "std"), no_std)]
18#![warn(missing_docs)]
19#![warn(clippy::all)]
20#![warn(clippy::pedantic)]
21// ML/tensor-specific allowances
22#![allow(clippy::cast_possible_truncation)]
23#![allow(clippy::cast_sign_loss)]
24#![allow(clippy::cast_precision_loss)]
25#![allow(clippy::cast_possible_wrap)]
26#![allow(clippy::missing_errors_doc)]
27#![allow(clippy::missing_panics_doc)]
28#![allow(clippy::must_use_candidate)]
29#![allow(clippy::module_name_repetitions)]
30#![allow(clippy::similar_names)]
31#![allow(clippy::many_single_char_names)]
32#![allow(clippy::too_many_arguments)]
33#![allow(clippy::doc_markdown)]
34#![allow(clippy::cast_lossless)]
35#![allow(clippy::needless_pass_by_value)]
36#![allow(clippy::redundant_closure_for_method_calls)]
37#![allow(clippy::uninlined_format_args)]
38#![allow(clippy::ptr_arg)]
39#![allow(clippy::return_self_not_must_use)]
40#![allow(clippy::not_unsafe_ptr_arg_deref)]
41#![allow(clippy::items_after_statements)]
42#![allow(clippy::unreadable_literal)]
43#![allow(clippy::if_same_then_else)]
44#![allow(clippy::needless_range_loop)]
45#![allow(clippy::trivially_copy_pass_by_ref)]
46#![allow(clippy::unnecessary_wraps)]
47#![allow(clippy::match_same_arms)]
48#![allow(clippy::unused_self)]
49#![allow(clippy::too_many_lines)]
50#![allow(clippy::single_match_else)]
51#![allow(clippy::fn_params_excessive_bools)]
52#![allow(clippy::struct_excessive_bools)]
53#![allow(clippy::format_push_string)]
54#![allow(clippy::erasing_op)]
55#![allow(clippy::type_repetition_in_bounds)]
56#![allow(clippy::iter_without_into_iter)]
57#![allow(clippy::should_implement_trait)]
58#![allow(clippy::use_debug)]
59#![allow(clippy::case_sensitive_file_extension_comparisons)]
60#![allow(clippy::large_enum_variant)]
61#![allow(clippy::panic)]
62#![allow(clippy::struct_field_names)]
63#![allow(clippy::missing_fields_in_debug)]
64#![allow(clippy::upper_case_acronyms)]
65#![allow(clippy::assigning_clones)]
66#![allow(clippy::option_if_let_else)]
67#![allow(clippy::manual_let_else)]
68#![allow(clippy::explicit_iter_loop)]
69#![allow(clippy::default_trait_access)]
70#![allow(clippy::only_used_in_recursion)]
71#![allow(clippy::manual_clamp)]
72#![allow(clippy::ref_option)]
73#![allow(clippy::multiple_bound_locations)]
74#![allow(clippy::comparison_chain)]
75#![allow(clippy::manual_assert)]
76#![allow(clippy::unnecessary_debug_formatting)]
77
78// =============================================================================
79// Modules
80// =============================================================================
81
82pub mod creation;
83#[cfg(feature = "cuda")]
84pub mod cuda_ops;
85pub mod lazy;
86pub mod ops;
87pub mod shape;
88pub mod sparse;
89pub mod tensor;
90pub mod view;
91
92// =============================================================================
93// Re-exports
94// =============================================================================
95
96pub use axonml_core::{DType, Device, Error, Result};
97pub use creation::*;
98pub use lazy::{LazyOp, LazyTensor};
99pub use shape::{Shape, Strides};
100pub use tensor::Tensor;
101
102// =============================================================================
103// Prelude
104// =============================================================================
105
106/// Convenient imports for common usage.
107pub mod prelude {
108    pub use crate::shape::{Shape, Strides};
109    pub use crate::tensor::Tensor;
110    pub use crate::{arange, full, linspace, ones, rand, randn, zeros};
111    pub use axonml_core::{DType, Device, Error, Result};
112}