concision_core/activate/traits/
ops.rs1pub trait SoftmaxAxis: SoftmaxActivation {
8 fn softmax_axis(self, axis: usize) -> Self::Output;
9}
10
11macro_rules! unary {
12 (@impl $name:ident::$call:ident($($rest:tt)*)) => {
13 paste::paste! {
14 pub trait $name {
15 type Output;
16
17 fn $call($($rest)*) -> Self::Output;
18
19 fn [<$call _derivative>]($($rest)*) -> Self::Output;
20 }
21 }
22 };
23 ($($name:ident::$call:ident($($rest:tt)*)),* $(,)?) => {
24 $(
25 unary!(@impl $name::$call($($rest)*));
26 )*
27 };
28}
29
30unary! {
31 HeavysideActivation::heavyside(self),
32 LinearActivation::linear(self),
33 SigmoidActivation::sigmoid(self),
34 SoftmaxActivation::softmax(&self),
35 ReLUActivation::relu(&self),
36 TanhActivation::tanh(&self),
37}