Crates.io | rust-lstm |
lib.rs | rust-lstm |
version | 0.1.0 |
source | src |
created_at | 2024-06-09 21:53:52.36335 |
updated_at | 2024-06-09 21:53:52.36335 |
description | A Rust library for LSTM (Long Short-Term Memory) neural networks. |
homepage | https://github.com/SyntaxSpirits/rust-lstm |
repository | https://github.com/SyntaxSpirits/rust-lstm |
max_upload_size | |
id | 1266641 |
size | 14,892 |
A simple LSTM (Long Short-Term Memory) neural network library implemented in Rust. This library provides basic functionalities to create and train LSTM networks.
Ensure you have Rust installed on your machine. If Rust is not already installed, you can install it by following the instructions on the official Rust website: https://www.rust-lang.org/tools/install.
To use Rust-LSTM in your project, add the following to your Cargo.toml:
[dependencies]
rust-lstm = "0.1.0"
Then, run the following command to build your project and download the Rust-LSTM crate:
cargo build
Here's a simple example demonstrating how to use the LSTM library:
use ndarray::Array2;
use rust_lstm::models::lstm_network::LSTMNetwork;
fn main() {
let input_size = 3;
let hidden_size = 2;
let num_layers = 2;
// Create an LSTM network
let network = LSTMNetwork::new(input_size, hidden_size, num_layers);
// Create some example input data
let input = Array2::from_shape_vec((input_size, 1), vec![0.5, 0.1, -0.3]).unwrap();
// Perform a forward pass
let output = network.forward(&input);
// Print the output
println!("Output: {:?}", output);
}
To run this example, save it as main.rs, and run:
cargo run
To run the tests included with Rust-LSTM, execute:
cargo test
This will run all the unit and integration tests defined in the library.
Contributions to Rust-LSTM are welcome! Here are a few ways you can help:
This project is licensed under the MIT License - see the LICENSE file for details.