kerasty
Keras for Candle (Rust ML framework) with support for Web Assembly.
Roadmap of Supported Layers
| Layer | State | Example |
|---|---|---|
| Dense | ✅ | Dense |
| Convolution | 🏗️ | CNN |
| Normalization | 🏗️ | Norm |
| Flatten | 🏗️ | Flatten |
| Pooling | 🏗️ | Pool |
| Recurrent | 🏗️ | RNN |
| Attention | 🏗️ | Attn |
| Bert | 🏗️ | BERT |
| Llama | 🏗️ | LLAMA |
Examples
Solution to the classic XOR problem
use ;
// Define the XOR input and output data
let x_data = vec!;
let x = from_slice?;
let y_data = vec!;
let y = from_slice?;
// Build the neural network model
let mut model = new;
model.add;
model.add;
// Compile the model
model.compile?;
// Train the model
model.fit?;
// Make predictions
let predictions = model.predict;
let predictions = predictions.reshape?.?;
let predictions: = predictions
.iter
.map
.collect;
println!;
for i in 0..4
The expected output is as follows:
Predictions:
Input: [0.0, 0.0] => Predicted Output: 0, Actual Output: 0
Input: [0.0, 1.0] => Predicted Output: 1, Actual Output: 1
Input: [1.0, 0.0] => Predicted Output: 1, Actual Output: 1
Input: [1.0, 1.0] => Predicted Output: 0, Actual Output: 0
License
MIT
Copyright © 2025-2035 Homero Roman Roman
Copyright © 2025-2035 Frederick Roman
Contributing
Contributions are welcome.
Please open an issue or a pull request to report a bug or request a feature.