concision_core/params/
mod.rs

1/*
2    Appellation: params <module>
3    Contrib: @FL03
4*/
5//! Parameters for constructing neural network models. This module implements parameters using
6//! the [ParamsBase] struct and its associated types. The [ParamsBase] struct provides:
7//!
8//! - An (n) dimensional weight tensor as [ArrayBase](ndarray::ArrayBase)
9//! - An (n-1) dimensional bias tensor as [ArrayBase](ndarray::ArrayBase)
10//!
11//! The associated types follow suite with the [`ndarray`] crate, each of which defines a
12//! different style of representation for the parameters.
13#[doc(inline)]
14pub use self::{error::ParamsError, params::ParamsBase};
15
16pub mod error;
17pub mod iter;
18pub mod params;
19
20mod impls {
21    mod impl_params;
22    #[allow(deprecated)]
23    mod impl_params_deprecated;
24    #[cfg(feature = "init")]
25    mod impl_params_init;
26    mod impl_params_iter;
27    mod impl_params_ops;
28    #[cfg(feature = "rand")]
29    mod impl_params_rand;
30    #[cfg(feature = "serde")]
31    mod impl_params_serde;
32}
33
34pub(crate) mod prelude {
35    pub use super::error::ParamsError;
36    pub use super::params::ParamsBase;
37    pub use super::{Params, ParamsView, ParamsViewMut};
38}
39
40/// a type alias for owned parameters
41pub type Params<A, D = ndarray::Ix2> = ParamsBase<ndarray::OwnedRepr<A>, D>;
42/// a type alias for shared parameters
43pub type ArcParams<A, D = ndarray::Ix2> = ParamsBase<ndarray::OwnedArcRepr<A>, D>;
44/// a type alias for an immutable view of the parameters
45pub type ParamsView<'a, A, D = ndarray::Ix2> = ParamsBase<ndarray::ViewRepr<&'a A>, D>;
46/// a type alias for a mutable view of the parameters
47pub type ParamsViewMut<'a, A, D = ndarray::Ix2> = ParamsBase<ndarray::ViewRepr<&'a mut A>, D>;
48/// a type alias for borrowed parameters
49pub type CowParams<'a, A, D = ndarray::Ix2> = ParamsBase<ndarray::CowRepr<'a, A>, D>;
50/// a raw view of the parameters; internally uses a constant pointer
51pub type RawViewParams<A, D = ndarray::Ix2> = ParamsBase<ndarray::RawViewRepr<*const A>, D>;
52/// a mutable raw view of the parameters; internally uses a mutable pointer
53pub type RawMutParams<A, D = ndarray::Ix2> = ParamsBase<ndarray::RawViewRepr<*mut A>, D>;