1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use burn_core as burn;
use burn::module::Module;
use burn::tensor::Tensor;
/// Applies the LogSigmoid activation function element-wise.
///
/// See also [log_sigmoid](burn::tensor::activation::log_sigmoid).
#[derive(Module, Debug, Default)]
pub struct LogSigmoid;
impl LogSigmoid {
/// Create the module.
pub fn new() -> Self {
Self {}
}
/// Applies the forward pass on the input tensor.
///
/// # Shapes
///
/// - input: `[..., any]`
/// - output: `[..., any]`
pub fn forward<const D: usize>(&self, input: Tensor<D>) -> Tensor<D> {
burn::tensor::activation::log_sigmoid(input)
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn display() {
let layer = LogSigmoid::new();
assert_eq!(alloc::format!("{layer}"), "LogSigmoid");
}
}