concision_params/impls/
impl_params_repr.rs1use crate::params_base::ParamsBase;
6
7use ndarray::{ArrayBase, DataOwned, Dimension, Ix1, Ix2, RawData};
8
9impl<A, S, D> ParamsBase<S, D, A>
10where
11 D: Dimension,
12 S: RawData<Elem = A>,
13{
14}
15
16impl<A, S> ParamsBase<S, Ix1>
17where
18 S: RawData<Elem = A>,
19{
20 pub fn from_scalar_bias(bias: A, weights: ArrayBase<S, Ix1>) -> Self
23 where
24 A: Clone,
25 S: DataOwned,
26 {
27 Self {
28 bias: ArrayBase::from_elem((), bias),
29 weights,
30 }
31 }
32 pub fn nrows(&self) -> usize {
34 self.weights().len()
35 }
36}
37
38impl<A, S> ParamsBase<S, Ix2>
39where
40 S: RawData<Elem = A>,
41{
42 pub fn ncols(&self) -> usize {
44 self.weights().ncols()
45 }
46 pub fn nrows(&self) -> usize {
48 self.weights().nrows()
49 }
50}