TensorState

Trait TensorState 

Source
pub trait TensorState<D: VeScalar>: Debug {
    // Required method
    fn clone_tensor_as<TargetMapping: M>(
        &self,
    ) -> Option<Tensor<D, TargetMapping>>;
}
Expand description

Marker trait that tracks tensor presence at compile time.

The type parameter D ties the stored tensor’s scalar type to the pipeline’s current scalar type, ensuring at compile time that tensor reads match the pipeline’s D.

Implementors either hold no data (NoTensor) or store a Tensor<D, Mapping> (HasTensor).

Required Methods§

Source

fn clone_tensor_as<TargetMapping: M>(&self) -> Option<Tensor<D, TargetMapping>>

Clones the tensor data, transposing to target mapping if needed.

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.

Implementors§

Source§

impl<D: VeScalar> TensorState<D> for NoTensor

Source§

impl<D: VeScalar, Mapping: M> TensorState<D> for HasTensor<D, Mapping>