concision_params/
lib.rs

1/*
2    Appellation: concision-params <library>
3    Created At: 2025.11.26:13:15:32
4    Contrib: @FL03
5*/
6//! In machine learning, each layer is composed of some set of neurons that process input data
7//! to produce some meaningful output. Each neuron typically has associated parameters, namely
8//! weights and biases, which are adjusted during training to optimize the model's performance.
9//!
10//! ## Overview
11//!
12//! The [`params`](self) crate provides a generic and flexible structure for handling these
13//! values. At its core, the [`ParamsBase`] object is defined as an object composed of two
14//! independent tensors:
15//!
16//! - An $n$ dimensional weight tensor
17//! - An $n-1$ dimensional bias tensor
18//!
19//! These tensors can be of any shape or size, allowing for a wide range of neural network
20//! architectures to be represented. The crate also provides various utilities and traits for
21//! manipulating and interacting with these parameters, making it easier to build and train
22//! neural networks.
23//!
24#![cfg_attr(not(feature = "std"), no_std)]
25#![allow(
26    clippy::missing_safety_doc,
27    clippy::module_inception,
28    clippy::needless_doctest_main,
29    clippy::should_implement_trait,
30    clippy::upper_case_acronyms,
31    rustdoc::redundant_explicit_links
32)]
33#![cfg_attr(all(feature = "nightly", feature = "alloc"), feature(allocator_api))]
34#![cfg_attr(all(feature = "nightly", feature = "autodiff"), feature(autodiff))]
35// compiler checks
36#[cfg(not(any(feature = "alloc", feature = "std")))]
37compiler_error! { "Either the \"alloc\" or \"std\" feature must be enabled for this crate." }
38// external crates
39#[cfg(feature = "alloc")]
40extern crate alloc;
41// macros
42#[macro_use]
43pub(crate) mod macros {
44    #[macro_use]
45    pub mod seal;
46}
47// public modules
48pub mod error;
49pub mod iter;
50// internal modules
51mod params_base;
52
53mod impls {
54    mod impl_params;
55    mod impl_params_ext;
56    mod impl_params_iter;
57    mod impl_params_ops;
58    mod impl_params_rand;
59    mod impl_params_ref;
60    mod impl_params_repr;
61    mod impl_params_serde;
62}
63
64mod traits {
65    #[doc(inline)]
66    pub use self::{iterators::*, raw_params::*, shape::*, wnb::*};
67
68    mod iterators;
69    mod raw_params;
70    mod shape;
71    mod wnb;
72}
73
74mod utils {
75    #[doc(inline)]
76    pub use self::shape::*;
77
78    mod shape;
79}
80// re-exports
81#[doc(inline)]
82pub use self::{error::*, params_base::*, traits::*, utils::*};
83// prelude
84#[doc(hidden)]
85pub mod prelude {
86    pub use crate::params_base::*;
87    pub use crate::traits::*;
88    pub use crate::utils::*;
89}