tenferro-runtime 0.8.0

Concrete tensor helpers, traced tensors, graph execution, and extension runtime support for tenferro.
Documentation
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};

#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
pub struct CompilerOptions {
    pub optimizer: OptimizerConfig,
}

#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct OptimizerConfig {
    pub algebraic_layout_simplifier: bool,
    pub dot_decomposer: bool,
}

impl OptimizerConfig {
    pub const VERSION: u64 = 3;

    pub fn fingerprint(self) -> u64 {
        let mut hasher = DefaultHasher::new();
        Self::VERSION.hash(&mut hasher);
        self.hash(&mut hasher);
        hasher.finish()
    }
}

impl Default for OptimizerConfig {
    fn default() -> Self {
        Self {
            algebraic_layout_simplifier: true,
            // Canonicalization only; the degenerate rewrite (#2111) is not
            // gated by this flag because it does not materialize a layout.
            dot_decomposer: false,
        }
    }
}