Preliminary state

This commit is contained in:
Anton Pogrebnjak
2026-05-26 10:24:33 +02:00
commit 0ab11cfc5e
950 changed files with 6428 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
use crate::{
core::{Primitive, Value},
interpreters::Interpreter,
};
struct EvalInterpreter {}
impl Interpreter for EvalInterpreter {
fn process_primitive(&mut self, primitive: Primitive) -> Box<dyn Value> {
use Primitive::*;
Box::new(match primitive {
Neg(x) => -x,
Reciprocal(x) => 1. / x,
Add(x, y) => x + y,
Mul(x, y) => x * y,
Sq(x) => x * x,
Sqrt(x) => x.sqrt(),
Ln(x) => x.ln(),
Exp(x) => x.exp(),
Dot(A, B) => A.dot(&B),
ReLU(x) => x.max(0.),
})
}
}