Skip to main content

sim_lib_numbers_tensor/
lib.rs

1#![forbid(unsafe_code)]
2#![allow(deprecated)]
3#![deny(missing_docs)]
4
5//! The n-dimensional tensor number domain: the uniform `Tensor` value, its
6//! domain registration and constructors (`tensor`, `vec`, `mat`, ...), and the
7//! `SpecTensor` interface that specialized element-type backends plug into.
8//! Tensor shape and dtype stay canonical while the open [`TensorStorage`]
9//! contract supplies boxed host or loadable resident storage. Observation
10//! through [`Tensor::cell`], [`Tensor::cells`], and [`Tensor::materialize`] is
11//! checked so encoding and projection report resident readback failures.
12
13mod implementation;
14mod spec;
15
16pub use implementation::{
17    BoxedTensorStorage, CpuTensorExecutor, SubmissionEvidence, Tensor, TensorCell, TensorExecError,
18    TensorExecution, TensorExecutor, TensorExecutorCard, TensorLocation, TensorMeta,
19    TensorNumbersLib, TensorOp, TensorRequest, TensorSite, TensorStorage, TypedTensorStorage,
20    active_tensor_executor, add_op_symbol, build_scalar_tensor_value, build_tensor_value,
21    cast_op_symbol, cast_symbol, cast_tensor, cast_tensor_value, cos_op_symbol, div_op_symbol,
22    dot_op_symbol, execute_tensor_binary_op, execute_tensor_dot, execute_tensor_matmul,
23    execute_tensor_norm, execute_tensor_reduction, execute_tensor_request,
24    execute_tensor_transcendental, execute_tensor_transpose, execute_tensor_unary_op,
25    exp_op_symbol, flatten_tensor_scalar_cells, index_op_symbol, map_op_symbol, mat_op_symbol,
26    matmul_exec_op_symbol, max_op_symbol, min_op_symbol, mul_op_symbol, neg_op_symbol,
27    norm_op_symbol, number_domain, pow_op_symbol, rem_op_symbol, reshape_op_symbol,
28    scalar_op_symbol, sin_op_symbol, slice_op_symbol, sqrt_op_symbol, sub_op_symbol, sum_op_symbol,
29    tensor_dtype, tensor_execute_capability, tensor_executor_math_op_symbols,
30    tensor_executor_symbol, tensor_op_symbol, tensor_site_symbol, tensor_value_class_symbol,
31    tensor_value_ref, transpose_exec_op_symbol, vec_op_symbol,
32};
33pub use sim_lib_numbers_core::domains;
34pub use spec::{
35    MAX_TENSOR_CELLS, SpecTensor, SpecTensorDescriptor, bounded_element_count,
36    checked_element_count, element_count, number_literal_for_tensor_cell, parse_bf16_literal_cell,
37    parse_complex_literal_cell, parse_f16_literal_cell, parse_f32_literal_cell,
38    parse_f64_literal_cell, parse_i64_literal_cell, parse_rational_literal_cell,
39    spec_tensor_descriptor_value, spec_tensor_symbol,
40};
41
42/// Cookbook recipes for this domain, embedded at build time.
43pub static RECIPES: sim_cookbook::EmbeddedDir =
44    include!(concat!(env!("OUT_DIR"), "/cookbook_recipes.rs"));
45
46#[cfg(test)]
47mod tests;