concision_core/
lib.rs

1/*
2    Appellation: concision-core <library>
3    Contrib: @FL03
4*/
5//! # concision-core
6//!
7//! This library provides the core abstractions and utilities for the concision (cnc) machine
8//! learning framework.
9//!
10//! ## Features
11//!
12//! - [`ParamsBase`]: A structure for defining the parameters within a neural network.
13//! - [`Backward`]: This trait establishes a common interface for backward propagation.
14//! - [`Forward`]: This trait denotes a single forward pass through a layer of a neural network
15//!
16#![allow(
17    clippy::missing_safety_doc,
18    clippy::module_inception,
19    clippy::needless_doctest_main,
20    clippy::upper_case_acronyms
21)]
22#![cfg_attr(not(feature = "std"), no_std)]
23#![crate_type = "lib"]
24
25#[cfg(feature = "alloc")]
26extern crate alloc;
27
28#[cfg(feature = "rand")]
29#[doc(no_inline)]
30pub use rand;
31#[cfg(feature = "rand")]
32#[doc(no_inline)]
33pub use rand_distr;
34
35/// this module establishes generic random initialization routines for models, params, and
36/// tensors.
37#[doc(inline)]
38#[cfg(feature = "cnc_init")]
39pub use concision_init as init;
40/// this module implements various utilities useful for developing machine learning models
41#[doc(inline)]
42#[cfg(feature = "cnc_utils")]
43pub use concision_utils as utils;
44
45#[cfg(feature = "cnc_init")]
46pub use self::init::prelude::*;
47#[cfg(feature = "cnc_utils")]
48pub use self::utils::prelude::*;
49
50#[doc(inline)]
51pub use self::{
52    activate::prelude::*,
53    error::*,
54    loss::prelude::*,
55    ops::prelude::*,
56    params::prelude::*,
57    tensor::{NdTensor, RawTensor, Tensor, TensorBase},
58    traits::*,
59};
60
61#[macro_use]
62pub(crate) mod macros {
63    #[macro_use]
64    pub mod seal;
65}
66/// this module is dedicated to activation function
67pub mod activate;
68/// this module provides the base [`Error`] type for the library
69pub mod error;
70/// this module focuses on the loss functions used in training neural networks.
71pub mod loss;
72/// this module provides the [`ParamsBase`] type for the library, which is used to define the
73/// parameters of a neural network.
74pub mod params;
75/// the [`tensor`] module provides various traits and types for handling n-dimensional tensors.
76pub mod tensor;
77
78pub mod ops {
79    //! This module provides the core operations for tensors, including filling, padding,
80    //! reshaping, and tensor manipulation.
81    #[doc(inline)]
82    pub use self::prelude::*;
83
84    pub mod fill;
85    pub mod pad;
86    pub mod reshape;
87    pub mod tensor;
88
89    pub(crate) mod prelude {
90        #[doc(inline)]
91        pub use super::fill::*;
92        #[doc(inline)]
93        pub use super::pad::*;
94        #[doc(inline)]
95        pub use super::reshape::*;
96        #[doc(inline)]
97        pub use super::tensor::*;
98    }
99}
100
101pub mod traits {
102    //! This module provides the core traits for the library, such as  [`Backward`] and
103    //! [`Forward`]
104    #[doc(inline)]
105    pub use self::prelude::*;
106
107    mod apply;
108    mod clip;
109    mod codex;
110    mod convert;
111    mod gradient;
112    mod like;
113    mod mask;
114    mod norm;
115    mod propagation;
116    mod shape;
117    mod wnb;
118
119    mod prelude {
120        #[doc(inline)]
121        pub use super::apply::*;
122        #[doc(inline)]
123        pub use super::clip::*;
124        #[doc(inline)]
125        pub use super::codex::*;
126        #[doc(inline)]
127        pub use super::convert::*;
128        #[doc(inline)]
129        pub use super::gradient::*;
130        #[doc(inline)]
131        pub use super::like::*;
132        #[doc(inline)]
133        pub use super::mask::*;
134        #[doc(inline)]
135        pub use super::norm::*;
136        #[doc(inline)]
137        pub use super::propagation::*;
138        #[doc(inline)]
139        pub use super::shape::*;
140        #[doc(inline)]
141        pub use super::wnb::*;
142    }
143}
144
145#[doc(hidden)]
146pub mod prelude {
147    #[cfg(feature = "cnc_init")]
148    pub use concision_init::prelude::*;
149    #[cfg(feature = "cnc_utils")]
150    pub use concision_utils::prelude::*;
151
152    #[doc(no_inline)]
153    pub use crate::activate::prelude::*;
154    #[doc(no_inline)]
155    pub use crate::loss::prelude::*;
156    #[doc(no_inline)]
157    pub use crate::ops::prelude::*;
158    #[doc(no_inline)]
159    pub use crate::params::prelude::*;
160    #[doc(inline)]
161    pub use crate::tensor::prelude::*;
162    #[doc(no_inline)]
163    pub use crate::traits::*;
164}