pub struct CpuBackend { /* private fields */ }Expand description
Implementations§
Source§impl CpuBackend
impl CpuBackend
Sourcepub fn new() -> CpuBackend
pub fn new() -> CpuBackend
Sourcepub fn try_new() -> Result<CpuBackend, Error>
pub fn try_new() -> Result<CpuBackend, Error>
Sourcepub fn from_context(ctx: Arc<CpuContext>) -> CpuBackend
pub fn from_context(ctx: Arc<CpuContext>) -> CpuBackend
Sourcepub fn with_threads(num_threads: usize) -> CpuBackend
pub fn with_threads(num_threads: usize) -> CpuBackend
Sourcepub fn num_threads(&self) -> usize
pub fn num_threads(&self) -> usize
Sourcepub fn buffer_pool_len(&self) -> usize
pub fn buffer_pool_len(&self) -> usize
Trait Implementations§
Source§impl Default for CpuBackend
impl Default for CpuBackend
Source§fn default() -> CpuBackend
fn default() -> CpuBackend
Returns the “default value” for a type. Read more
Source§impl<Alg> SemiringBackend<Alg> for CpuBackendwhere
Alg: Semiring,
impl<Alg> SemiringBackend<Alg> for CpuBackendwhere
Alg: Semiring,
fn batched_gemm( &mut self, lhs: &TypedTensor<<Alg as Algebra>::Scalar>, rhs: &TypedTensor<<Alg as Algebra>::Scalar>, config: &DotGeneralConfig, ) -> Result<TypedTensor<<Alg as Algebra>::Scalar>, Error>
fn add( &mut self, lhs: &TypedTensor<<Alg as Algebra>::Scalar>, rhs: &TypedTensor<<Alg as Algebra>::Scalar>, ) -> Result<TypedTensor<<Alg as Algebra>::Scalar>, Error>
fn mul( &mut self, lhs: &TypedTensor<<Alg as Algebra>::Scalar>, rhs: &TypedTensor<<Alg as Algebra>::Scalar>, ) -> Result<TypedTensor<<Alg as Algebra>::Scalar>, Error>
fn reduce_sum( &mut self, input: &TypedTensor<<Alg as Algebra>::Scalar>, axes: &[usize], ) -> Result<TypedTensor<<Alg as Algebra>::Scalar>, Error>
Source§impl TensorBackend for CpuBackend
impl TensorBackend for CpuBackend
fn add(&mut self, lhs: &Tensor, rhs: &Tensor) -> Result<Tensor, Error>
fn mul(&mut self, lhs: &Tensor, rhs: &Tensor) -> Result<Tensor, Error>
fn neg(&mut self, input: &Tensor) -> Result<Tensor, Error>
fn conj(&mut self, input: &Tensor) -> Result<Tensor, Error>
fn div(&mut self, lhs: &Tensor, rhs: &Tensor) -> Result<Tensor, Error>
fn abs(&mut self, input: &Tensor) -> Result<Tensor, Error>
fn sign(&mut self, input: &Tensor) -> Result<Tensor, Error>
fn maximum(&mut self, lhs: &Tensor, rhs: &Tensor) -> Result<Tensor, Error>
fn minimum(&mut self, lhs: &Tensor, rhs: &Tensor) -> Result<Tensor, Error>
fn compare( &mut self, lhs: &Tensor, rhs: &Tensor, dir: &CompareDir, ) -> Result<Tensor, Error>
fn select( &mut self, pred: &Tensor, on_true: &Tensor, on_false: &Tensor, ) -> Result<Tensor, Error>
fn clamp( &mut self, input: &Tensor, lower: &Tensor, upper: &Tensor, ) -> Result<Tensor, Error>
fn exp(&mut self, input: &Tensor) -> Result<Tensor, Error>
fn log(&mut self, input: &Tensor) -> Result<Tensor, Error>
fn sin(&mut self, input: &Tensor) -> Result<Tensor, Error>
fn cos(&mut self, input: &Tensor) -> Result<Tensor, Error>
fn tanh(&mut self, input: &Tensor) -> Result<Tensor, Error>
fn sqrt(&mut self, input: &Tensor) -> Result<Tensor, Error>
fn rsqrt(&mut self, input: &Tensor) -> Result<Tensor, Error>
fn pow(&mut self, lhs: &Tensor, rhs: &Tensor) -> Result<Tensor, Error>
fn expm1(&mut self, input: &Tensor) -> Result<Tensor, Error>
fn log1p(&mut self, input: &Tensor) -> Result<Tensor, Error>
fn transpose(&mut self, input: &Tensor, perm: &[usize]) -> Result<Tensor, Error>
fn reshape(&mut self, input: &Tensor, shape: &[usize]) -> Result<Tensor, Error>
fn broadcast_in_dim( &mut self, input: &Tensor, shape: &[usize], dims: &[usize], ) -> Result<Tensor, Error>
fn convert(&mut self, input: &Tensor, to: DType) -> Result<Tensor, Error>
fn extract_diagonal( &mut self, input: &Tensor, axis_a: usize, axis_b: usize, ) -> Result<Tensor, Error>
fn embed_diagonal( &mut self, input: &Tensor, axis_a: usize, axis_b: usize, ) -> Result<Tensor, Error>
fn tril(&mut self, input: &Tensor, k: i64) -> Result<Tensor, Error>
fn triu(&mut self, input: &Tensor, k: i64) -> Result<Tensor, Error>
fn reduce_sum( &mut self, input: &Tensor, axes: &[usize], ) -> Result<Tensor, Error>
fn reduce_prod( &mut self, input: &Tensor, axes: &[usize], ) -> Result<Tensor, Error>
fn reduce_max( &mut self, input: &Tensor, axes: &[usize], ) -> Result<Tensor, Error>
fn reduce_min( &mut self, input: &Tensor, axes: &[usize], ) -> Result<Tensor, Error>
fn dot_general( &mut self, lhs: &Tensor, rhs: &Tensor, config: &DotGeneralConfig, ) -> Result<Tensor, Error>
fn gather( &mut self, operand: &Tensor, start_indices: &Tensor, config: &GatherConfig, ) -> Result<Tensor, Error>
fn scatter( &mut self, operand: &Tensor, scatter_indices: &Tensor, updates: &Tensor, config: &ScatterConfig, ) -> Result<Tensor, Error>
fn slice( &mut self, input: &Tensor, config: &SliceConfig, ) -> Result<Tensor, Error>
fn dynamic_slice( &mut self, input: &Tensor, starts: &Tensor, slice_sizes: &[usize], ) -> Result<Tensor, Error>
fn pad(&mut self, input: &Tensor, config: &PadConfig) -> Result<Tensor, Error>
fn concatenate( &mut self, inputs: &[&Tensor], axis: usize, ) -> Result<Tensor, Error>
fn reverse(&mut self, input: &Tensor, axes: &[usize]) -> Result<Tensor, Error>
fn cholesky(&mut self, input: &Tensor) -> Result<Tensor, Error>
fn triangular_solve( &mut self, a: &Tensor, b: &Tensor, left_side: bool, lower: bool, transpose_a: bool, unit_diagonal: bool, ) -> Result<Tensor, Error>
fn lu(&mut self, input: &Tensor) -> Result<Vec<Tensor>, Error>
fn svd(&mut self, input: &Tensor) -> Result<Vec<Tensor>, Error>
fn qr(&mut self, input: &Tensor) -> Result<Vec<Tensor>, Error>
fn eigh(&mut self, input: &Tensor) -> Result<Vec<Tensor>, Error>
fn eig(&mut self, input: &Tensor) -> Result<Vec<Tensor>, Error>
fn solve(&mut self, a: &Tensor, b: &Tensor) -> Result<Tensor, Error>
Source§fn with_exec_session<R>(
&mut self,
f: impl FnOnce(&mut dyn TensorExec) -> R + Send,
) -> Rwhere
R: Send,
fn with_exec_session<R>(
&mut self,
f: impl FnOnce(&mut dyn TensorExec) -> R + Send,
) -> Rwhere
R: Send,
Execute a batch of operations inside the backend’s execution context. Read more
Source§fn reclaim_buffer(&mut self, tensor: Tensor)
fn reclaim_buffer(&mut self, tensor: Tensor)
Reclaim a tensor buffer for backend-specific reuse. Read more
Auto Trait Implementations§
impl Freeze for CpuBackend
impl !RefUnwindSafe for CpuBackend
impl Send for CpuBackend
impl Sync for CpuBackend
impl Unpin for CpuBackend
impl UnsafeUnpin for CpuBackend
impl !UnwindSafe for CpuBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more