| Crates.io | flashlight |
| lib.rs | flashlight |
| version | 0.0.11 |
| created_at | 2025-04-19 14:27:45.907486+00 |
| updated_at | 2025-05-02 18:50:43.508802+00 |
| description | neural network library,*not* abandoned |
| homepage | https://github.com/Bejmach/flashlight |
| repository | https://github.com/Bejmach/flashlight |
| max_upload_size | |
| id | 1640696 |
| size | 41,916 |
Package currently in development, use something else, like burn
project not related to similarly named flashlight. The name was coincidental and chosen independently.
[depencencies]
flashlight = "0.0.11"
flashlight_tensor = "0.2.6"
use flashlight::prelude::*;
use flashlight_tensor::prelude::*;
impl NewModel{
fn new() -> Self{
Self{
linear1: Linear::new(2, 16, 0.01),
linear2: Linear::new(16, 1, 0.01),
activation: Relu::new(),
output_activation: Sigmoid::new(),
}
}
fn grad_output(&self, target: &Tensor<f32>) -> Tensor<f32>{
self.output_activation.grad_output(target)
}
}
impl Model for NewModel{
fn forward(&mut self, input: Tensor<f32>) -> Tensor<f32> {
let x = self.linear1.forward(&input);
let x = self.activation.forward(&x);
let x = self.linear2.forward(&x);
self.output_activation.forward(&x)
}
fn backward(&mut self, grad_output: Tensor<f32>) {
let x = self.output_activation.backward(&grad_output);
let x = self.linear2.backward(&x);
let x = self.activation.backward(&x);
self.linear1.backward(&x);
}
}
Before I decided on the name, I wanted to use some mythology reference, because I assumed that the "Torch" library based its name on Prometheus myth, but it didn't click.
Some time after that, I thought to myself "Why base the name on some mythical meaning of stuff, when I can refer to them literally.", and that's when I came up with three name ideas for project: "Lamp", "Bulb" and "Flashlight", and well... I decided on "Flashlight" because It sounded the goofiest of them all.
Sure, I could've tried to justify it with something like, "Flashlight is written in Rust and Torch is written In C, so Flashlight is safer, like how flashlights are safer than torches..." but I would be lying if I did. I decided on that name because it was funny, and I didn’t think it would actually fit the project — but here we are.
I hope you had a good time reading this short personal story. I just rly wanted to include that in the readme, so deal with it.
P.S. I literally have no idea what I'm doing here. I just thought one day, "Creating neural network from scratch while learning new language is a great idea". I dont even know how all math is working. I understand the concept, and try to deal with it.