inference/tensor.rs

xberg · crates/xberg/src/inference/tensor.rs · rust · MIT
ai

Engine-neutral Rust tensor type for inference, supporting multiple backends.

// Source: https://github.com/xberg-io/xberg | License: MIT | Copyright 2025-2026 Kreuzberg, Inc
// Provided via justclaw.it.com; keep this notice with the code.
//! Engine-neutral tensor currency for the inference seam.
//!
//! [`InferenceTensor`] is the type exchanged across the [`InferenceSession`] API,
//! independent of the backing engine (ONNX Runtime today; tract on no-ORT targets
//! in a later phase). Each variant wraps an owned dynamic-dimensional
//! [`ndarray::ArrayD`] — callers build inputs with [`ndarray`] and read outputs
//! back as views or slices. Engine-specific conversions (`ort::Value` ↔ tensor)
//! live next to their backend, keeping this module pure `ndarray`.
//!
//! [`InferenceSession`]: super::InferenceSession
//!

use ndarray::ArrayD;

/// A dense tensor passed a

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key