Trait Backend
Source pub trait Backend:
Debug
+ Send
+ Sync {
// Required methods
fn zeros(&self, shape: &Shape) -> Result<Storage>;
fn ones(&self, shape: &Shape) -> Result<Storage>;
fn from_slice(&self, data: &[f32], shape: &Shape) -> Result<Storage>;
fn add(&self, lhs: &Storage, rhs: &Storage) -> Result<Storage>;
fn sub(&self, lhs: &Storage, rhs: &Storage) -> Result<Storage>;
fn mul(&self, lhs: &Storage, rhs: &Storage) -> Result<Storage>;
fn div(&self, lhs: &Storage, rhs: &Storage) -> Result<Storage>;
fn sum(&self, storage: &Storage, axis: Option<usize>) -> Result<Storage>;
fn mean(&self, storage: &Storage, axis: Option<usize>) -> Result<Storage>;
fn transpose(&self, storage: &Storage, shape: &Shape) -> Result<Storage>;
fn to_vec_f32(&self, storage: &Storage) -> Result<Vec<f32>>;
// Provided method
fn is_available(&self) -> bool { ... }
}