Skip to main content

BackendFactory

Trait BackendFactory 

Source
pub trait BackendFactory: Send + Sync {
    // Required methods
    fn create_compute_backend<'life0, 'life1, 'async_trait>(
        &'life0 self,
        config: &'life1 BackendConfig,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn ComputeBackend>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn create_weight_loader<'life0, 'life1, 'async_trait>(
        &'life0 self,
        config: &'life1 WeightLoaderConfig,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn WeightLoader>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn supported_backend_types(&self) -> Vec<BackendType>;
    fn validate_config(&self, config: &BackendConfig) -> Result<()>;
}
Expand description

Backend factory for creating backend instances

Required Methods§

Source

fn create_compute_backend<'life0, 'life1, 'async_trait>( &'life0 self, config: &'life1 BackendConfig, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn ComputeBackend>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create compute backend

Source

fn create_weight_loader<'life0, 'life1, 'async_trait>( &'life0 self, config: &'life1 WeightLoaderConfig, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn WeightLoader>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create weight loader

Source

fn supported_backend_types(&self) -> Vec<BackendType>

Get supported backend types

Source

fn validate_config(&self, config: &BackendConfig) -> Result<()>

Validate backend configuration

Implementors§