Skip to main content

Crate oxfuse_runtime

Crate oxfuse_runtime 

Source
Expand description

Tensors, execution plans and the CPU backends: a plain reference backend and a fast backend that returns exactly the same bits (the parallel feature adds threads and still does not change a bit).

Part of oxfuse. Build a graph with oxfuse-core, then compile and run it:

use oxfuse_core::{GraphBuilder, Limits, Op};
use oxfuse_runtime::{Backend, CpuBackend, Tensor};

let mut b = GraphBuilder::new(Limits::default());
let x = b.input("x", vec![2])?;
let y = b.node("y", Op::Relu, &[x])?;
let graph = b.finish(&[y])?;

let input = Tensor::new(vec![2], vec![-1.0, 2.0])?;
let out = CpuBackend.compile(&graph)?.run(&[input])?;
assert_eq!(out[0].data(), &[0.0, 2.0]);

Structs§

CpuBackend
InputBinding
Plan
ReferenceBackend
ReferenceEvaluator
Step
Tensor

Traits§

Backend
Executable

Functions§

sigmoid
1 / (1 + e^-x), the definition of the Sigmoid op: the same bits on every platform. Large negative x makes exp overflow to infinity and the result 0, without NaN.