25 lines
527 B
Rust
25 lines
527 B
Rust
use burn::{Tensor, module::Module, prelude::Backend, tensor::backend::AutodiffBackend};
|
|
|
|
#[derive(Debug, Module)]
|
|
pub struct LIF<B: Backend> {
|
|
pub v: Tensor<B, 1>,
|
|
}
|
|
|
|
impl<B: Backend> LIF<B> {
|
|
pub fn new(device: &B::Device) -> Self {
|
|
Self {
|
|
v: Tensor::zeros([1], device),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl<B: AutodiffBackend> LIF<B> {
|
|
pub fn forward(&mut self, input: Tensor<B, 2>) -> Tensor<B, 2> {
|
|
input
|
|
}
|
|
|
|
pub fn backward(&mut self, x: Tensor<B, 2>) -> Tensor<B, 2> {
|
|
x
|
|
}
|
|
}
|