pub trait Backend: Send + Sync {
type Weights: Send + Sync;
type Plan: Send;
// Required methods
fn caps(&self) -> Caps;
fn upload(
&self,
tensors: &[HostTensor<'_>],
graph: &Graph,
) -> Result<Self::Weights>;
fn lower(
&self,
w: &Self::Weights,
graph: &Graph,
bucket: Bucket,
) -> Result<Self::Plan>;
fn run(
&self,
plan: &mut Self::Plan,
batch: &Batch<'_>,
out: &mut Outputs,
) -> Result<()>;
}Expand description
A device that runs graphs. The engine is generic over it, so the path through it is monomorphized and there is no dynamic dispatch per op.
Required Associated Types§
Required Methods§
Sourcefn upload(
&self,
tensors: &[HostTensor<'_>],
graph: &Graph,
) -> Result<Self::Weights>
fn upload( &self, tensors: &[HostTensor<'_>], graph: &Graph, ) -> Result<Self::Weights>
Converts a checkpoint’s tensors, indexed as the graph’s weights are.
§Errors
When a tensor cannot be converted.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".