elara_math/lib.rs
1/*! This crate is a Rust-native tensor and math library,
2developed for [Project Elara](https://github.com/elaraproject). It aims to
3be a building block of a comprehensive machine learing and scientific computing
4library in Rust. It tries to give a Rust experience similar to [SciPy](https://scipy.org/),
5[NumPy](https://numpy.org/), and [PyTorch](https://pytorch.org/)/[TensorFlow](https://www.tensorflow.org/),
6offering:
7
8- Tensors: N-dimensional differentiable arrays (via `Tensor`)
9- An implementation of reverse-mode autodifferentiation
10- Numerical solvers for calculus (only numerical integral evaluation is fully-supported at the moment, the ODE solver has been moved to [`elara-array`](https://github.com/elaraproject/elara-array)):
11*/
12
13mod integrate;
14mod nn;
15mod tensor;
16
17pub use nn::*;
18pub use tensor::*;
19
20/// `elara-math` prelude
21pub mod prelude;
22
23/// Mean squared error function
24pub fn mse(predicted: &Tensor, target: &Tensor) -> Tensor {
25 let out = target - predicted;
26 (&out * &out).mean()
27}