Skip to main content

tract_data/
lib.rs

1#![allow(clippy::len_zero)]
2#![allow(clippy::missing_safety_doc)]
3
4pub extern crate itertools;
5
6#[macro_use]
7mod macros;
8
9/// A Smallvec instantiation with 4 embeddable values.
10///
11/// Used about everywhere in tract, for node inputs and outputs, or
12/// tensor dimensions.
13pub type TVec<T> = smallvec::SmallVec<[T; 4]>;
14
15pub type TractError = anyhow::Error;
16pub type TractResult<T> = anyhow::Result<T>;
17
18pub mod prelude {
19    pub use crate::TVec;
20    pub use crate::blob::Blob;
21    pub use crate::datum::{Datum, DatumType, QParams, round_ties_to_even};
22    pub use crate::dim::{Assertion, Symbol, SymbolScope, SymbolValues, TDim, ToDim};
23    pub use crate::tensor::litteral::*;
24    pub use crate::tensor::plain_view::{PlainView, PlainViewMut};
25    pub use crate::tensor::storage::{PlainStorage, TensorStorage};
26    pub use crate::tensor::{IntoArcTensor, IntoTensor, Tensor, natural_strides};
27    #[cfg(feature = "complex")]
28    pub use crate::tensor::{reinterpret_complex_as_inner_dim, reinterpret_inner_dim_as_complex};
29    pub use crate::tvec;
30    pub use crate::{TractError, TractResult};
31    pub use crate::{
32        dispatch_copy, dispatch_copy_by_size, dispatch_datum, dispatch_datum_by_size,
33        dispatch_floatlike, dispatch_hash, dispatch_numbers, dispatch_signed,
34    };
35    pub use half::f16;
36    pub use itertools as tract_itertools;
37    #[cfg(feature = "complex")]
38    pub use num_complex::Complex;
39}
40
41pub mod internal {
42    pub use crate::datum::ClampCast;
43    pub use crate::dim::{DimLike, parse_tdim, solve_for};
44    pub use crate::exotic::ExoticFact;
45    pub use crate::prelude::*;
46    pub use crate::tensor::Approximation;
47    pub use crate::tensor::view::TensorView;
48    pub use crate::tensor::{clip_range_bounds, vector_size};
49    pub use anyhow::{Context as TractErrorContext, anyhow, bail, ensure, format_err};
50    pub use ndarray as tract_ndarray;
51    pub use num_integer;
52    pub use num_traits as tract_num_traits;
53    pub use smallvec as tract_smallvec;
54    pub type StaticName = std::borrow::Cow<'static, str>;
55}
56
57pub use dim::TooEarly;
58pub use half;
59
60mod blob;
61mod datum;
62mod dim;
63mod exotic;
64mod scatter;
65mod tensor;