pub trait TropicalScalar: Scalar {
type Inner: Scalar + Float + AddAssign + HasAlgebra<Algebra = Standard<Self::Inner>>;
// Required methods
fn inner(&self) -> Self::Inner;
fn from_inner(v: Self::Inner) -> Self;
fn mul_backward_a(
a_inner: Self::Inner,
b_inner: Self::Inner,
dout: Self::Inner,
) -> Self::Inner;
fn mul_backward_b(
a_inner: Self::Inner,
b_inner: Self::Inner,
dout: Self::Inner,
) -> Self::Inner;
}Expand description
Trait for extracting the inner float type from a tropical scalar wrapper.
This enables generic code that operates on the inner values for backward pass computations.
§Examples
ⓘ
use tenferro_ext_tropical::MaxPlus;
use tenferro_ext_tropical::ad::TropicalScalar;
let x = MaxPlus(3.0_f64);
assert_eq!(x.inner(), 3.0);Required Associated Types§
Required Methods§
Sourcefn from_inner(v: Self::Inner) -> Self
fn from_inner(v: Self::Inner) -> Self
Wrap an inner value into the tropical type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.