lmm 0.1.2

A language agnostic framework for emulating reality.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::error::LmmError::Perception;
use crate::error::Result;
use crate::tensor::Tensor;
use crate::traits::Perceivable;

pub struct MultiModalPerception;

impl Perceivable for MultiModalPerception {
    fn ingest(raw_data: &[u8]) -> Result<Tensor> {
        if raw_data.is_empty() {
            return Err(Perception("Empty input data".into()));
        }
        let float_data: Vec<f64> = raw_data.iter().map(|&b| f64::from(b) / 255.0).collect();
        Tensor::new(vec![float_data.len()], float_data)
    }
}