pub trait AccelerateBackend: Send + Sync {
// Required methods
fn device_info(&self) -> DeviceInfo;
fn upload_matrix(&self, host: &Tensor) -> Result<Box<dyn DeviceMatrix>>;
fn download_matrix(&self, dev: &dyn DeviceMatrix) -> Result<Tensor>;
fn elem_add(
&self,
a: &dyn DeviceMatrix,
b: &dyn DeviceMatrix,
) -> Result<Box<dyn DeviceMatrix>>;
fn elem_sub(
&self,
a: &dyn DeviceMatrix,
b: &dyn DeviceMatrix,
) -> Result<Box<dyn DeviceMatrix>>;
fn elem_mul(
&self,
a: &dyn DeviceMatrix,
b: &dyn DeviceMatrix,
) -> Result<Box<dyn DeviceMatrix>>;
fn elem_ne(
&self,
a: &dyn DeviceMatrix,
b: &dyn DeviceMatrix,
) -> Result<Box<dyn DeviceMatrix>>;
fn elem_eq(
&self,
a: &dyn DeviceMatrix,
b: &dyn DeviceMatrix,
) -> Result<Box<dyn DeviceMatrix>>;
fn elem_div(
&self,
a: &dyn DeviceMatrix,
b: &dyn DeviceMatrix,
) -> Result<Box<dyn DeviceMatrix>>;
fn elem_pow(
&self,
a: &dyn DeviceMatrix,
b: &dyn DeviceMatrix,
) -> Result<Box<dyn DeviceMatrix>>;
fn matmul(
&self,
a: &dyn DeviceMatrix,
b: &dyn DeviceMatrix,
) -> Result<Box<dyn DeviceMatrix>>;
fn transpose(&self, a: &dyn DeviceMatrix) -> Result<Box<dyn DeviceMatrix>>;
}Expand description
Core backend interface that concrete backends must implement.
Required Methods§
fn device_info(&self) -> DeviceInfo
fn upload_matrix(&self, host: &Tensor) -> Result<Box<dyn DeviceMatrix>>
fn download_matrix(&self, dev: &dyn DeviceMatrix) -> Result<Tensor>
fn elem_add( &self, a: &dyn DeviceMatrix, b: &dyn DeviceMatrix, ) -> Result<Box<dyn DeviceMatrix>>
fn elem_sub( &self, a: &dyn DeviceMatrix, b: &dyn DeviceMatrix, ) -> Result<Box<dyn DeviceMatrix>>
fn elem_mul( &self, a: &dyn DeviceMatrix, b: &dyn DeviceMatrix, ) -> Result<Box<dyn DeviceMatrix>>
fn elem_ne( &self, a: &dyn DeviceMatrix, b: &dyn DeviceMatrix, ) -> Result<Box<dyn DeviceMatrix>>
fn elem_eq( &self, a: &dyn DeviceMatrix, b: &dyn DeviceMatrix, ) -> Result<Box<dyn DeviceMatrix>>
fn elem_div( &self, a: &dyn DeviceMatrix, b: &dyn DeviceMatrix, ) -> Result<Box<dyn DeviceMatrix>>
fn elem_pow( &self, a: &dyn DeviceMatrix, b: &dyn DeviceMatrix, ) -> Result<Box<dyn DeviceMatrix>>
fn matmul( &self, a: &dyn DeviceMatrix, b: &dyn DeviceMatrix, ) -> Result<Box<dyn DeviceMatrix>>
fn transpose(&self, a: &dyn DeviceMatrix) -> Result<Box<dyn DeviceMatrix>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".