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    mod impl_params_init;
25    mod impl_params_iter;
26    mod impl_params_ops;
27    #[cfg(feature = "rand")]
28    mod impl_params_rand;
29}
30
31pub(crate) mod prelude {
32    pub use super::error::ParamsError;
33    pub use super::params::ParamsBase;
34    pub use super::{Params, ParamsView, ParamsViewMut};
35}
36
37/// a type alias for owned parameters
38pub type Params<A, D = ndarray::Ix2> = ParamsBase<ndarray::OwnedRepr<A>, D>;
39/// a type alias for shared parameters
40pub type ArcParams<A, D = ndarray::Ix2> = ParamsBase<ndarray::OwnedArcRepr<A>, D>;
41/// a type alias for an immutable view of the parameters
42pub type ParamsView<'a, A, D = ndarray::Ix2> = ParamsBase<ndarray::ViewRepr<&'a A>, D>;
43/// a type alias for a mutable view of the parameters
44pub type ParamsViewMut<'a, A, D = ndarray::Ix2> = ParamsBase<ndarray::ViewRepr<&'a mut A>, D>;
45/// a type alias for borrowed parameters
46pub type CowParams<'a, A, D = ndarray::Ix2> = ParamsBase<ndarray::CowRepr<'a, A>, D>;
47/// a raw view of the parameters; internally uses a constant pointer
48pub type RawViewParams<A, D = ndarray::Ix2> = ParamsBase<ndarray::RawViewRepr<*const A>, D>;
49/// a mutable raw view of the parameters; internally uses a mutable pointer
50pub type RawMutParams<A, D = ndarray::Ix2> = ParamsBase<ndarray::RawViewRepr<*mut A>, D>;