native_neural_network 0.3.1

Lib no_std Rust for native neural network (.rnn)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use crate::scratch::Scratch;

pub fn usage_bytes(scratch: &Scratch<'_>) -> usize {
    scratch.as_slice().len()
}

pub fn usage_ratio(scratch: &Scratch<'_>, capacity: usize) -> f32 {
    if capacity == 0 {
        return 0.0;
    }
    usage_bytes(scratch) as f32 / capacity as f32
}