|
5 | 5 | use super::LayerBase; |
6 | 6 |
|
7 | 7 | use concision_params::{ParamsBase, RawParams}; |
8 | | -use concision_traits::{Activator, Linear, ReLU, Sigmoid, TanhActivator}; |
| 8 | +use concision_traits::{Activator, HyperbolicTangent, Linear, ReLU, Sigmoid}; |
9 | 9 | use ndarray::{ArrayBase, DataOwned, Dimension, RawData, RemoveAxis, ShapeBuilder}; |
10 | 10 |
|
11 | 11 | impl<F, S, D, A> LayerBase<F, ArrayBase<S, D, A>> |
|
27 | 27 | params: ArrayBase::default(shape), |
28 | 28 | } |
29 | 29 | } |
| 30 | + |
| 31 | + pub fn dim(&self) -> D::Pattern { |
| 32 | + self.params().dim() |
| 33 | + } |
| 34 | + |
| 35 | + pub fn raw_dim(&self) -> D { |
| 36 | + self.params().raw_dim() |
| 37 | + } |
| 38 | + |
| 39 | + pub fn shape(&self) -> &[usize] { |
| 40 | + self.params().shape() |
| 41 | + } |
30 | 42 | } |
31 | 43 |
|
32 | 44 | impl<F, S, D, E, A> LayerBase<F, ParamsBase<S, D, A>> |
|
65 | 77 | pub const fn weights_mut(&mut self) -> &mut ArrayBase<S, D, A> { |
66 | 78 | self.params_mut().weights_mut() |
67 | 79 | } |
| 80 | + |
| 81 | + pub fn dim(&self) -> D::Pattern { |
| 82 | + self.params().dim() |
| 83 | + } |
| 84 | + |
| 85 | + pub fn raw_dim(&self) -> D { |
| 86 | + self.params().raw_dim() |
| 87 | + } |
| 88 | + |
| 89 | + pub fn shape(&self) -> &[usize] { |
| 90 | + self.params().shape() |
| 91 | + } |
68 | 92 | } |
69 | 93 |
|
70 | 94 | impl<F, P, A> LayerBase<F, P> |
@@ -100,15 +124,15 @@ where |
100 | 124 | } |
101 | 125 | } |
102 | 126 |
|
103 | | -impl<A, P> LayerBase<TanhActivator, P> |
| 127 | +impl<A, P> LayerBase<HyperbolicTangent, P> |
104 | 128 | where |
105 | 129 | P: RawParams<Elem = A>, |
106 | 130 | { |
107 | | - /// initialize a new layer using a [`HyperbolicTangent`] activation function and the given |
| 131 | + /// initialize a new layer using a [`TanhActivator`] activation function and the given |
108 | 132 | /// parameters. |
109 | 133 | pub const fn tanh(params: P) -> Self { |
110 | 134 | Self { |
111 | | - rho: TanhActivator, |
| 135 | + rho: HyperbolicTangent, |
112 | 136 | params, |
113 | 137 | } |
114 | 138 | } |
|
0 commit comments