pub struct CpuBackend { /* private fields */ }Expand description
Implementations§
Source§impl CpuBackend
impl CpuBackend
Sourcepub fn from_context(ctx: Arc<CpuContext>) -> Self
pub fn from_context(ctx: Arc<CpuContext>) -> Self
Sourcepub fn with_threads(num_threads: usize) -> Self
pub fn with_threads(num_threads: usize) -> Self
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§impl<Alg: Semiring> SemiringBackend<Alg> for CpuBackend
impl<Alg: Semiring> SemiringBackend<Alg> for CpuBackend
fn batched_gemm( &mut self, lhs: &TypedTensor<Alg::Scalar>, rhs: &TypedTensor<Alg::Scalar>, config: &DotGeneralConfig, ) -> Result<TypedTensor<Alg::Scalar>>
fn add( &mut self, lhs: &TypedTensor<Alg::Scalar>, rhs: &TypedTensor<Alg::Scalar>, ) -> Result<TypedTensor<Alg::Scalar>>
fn mul( &mut self, lhs: &TypedTensor<Alg::Scalar>, rhs: &TypedTensor<Alg::Scalar>, ) -> Result<TypedTensor<Alg::Scalar>>
fn reduce_sum( &mut self, input: &TypedTensor<Alg::Scalar>, axes: &[usize], ) -> Result<TypedTensor<Alg::Scalar>>
Source§impl TensorBackend for CpuBackend
impl TensorBackend for CpuBackend
fn add(&mut self, lhs: &Tensor, rhs: &Tensor) -> Result<Tensor>
fn mul(&mut self, lhs: &Tensor, rhs: &Tensor) -> Result<Tensor>
fn neg(&mut self, input: &Tensor) -> Result<Tensor>
fn conj(&mut self, input: &Tensor) -> Result<Tensor>
fn div(&mut self, lhs: &Tensor, rhs: &Tensor) -> Result<Tensor>
fn abs(&mut self, input: &Tensor) -> Result<Tensor>
fn sign(&mut self, input: &Tensor) -> Result<Tensor>
fn maximum(&mut self, lhs: &Tensor, rhs: &Tensor) -> Result<Tensor>
fn minimum(&mut self, lhs: &Tensor, rhs: &Tensor) -> Result<Tensor>
fn compare( &mut self, lhs: &Tensor, rhs: &Tensor, dir: &CompareDir, ) -> Result<Tensor>
fn select( &mut self, pred: &Tensor, on_true: &Tensor, on_false: &Tensor, ) -> Result<Tensor>
fn clamp( &mut self, input: &Tensor, lower: &Tensor, upper: &Tensor, ) -> Result<Tensor>
fn exp(&mut self, input: &Tensor) -> Result<Tensor>
fn log(&mut self, input: &Tensor) -> Result<Tensor>
fn sin(&mut self, input: &Tensor) -> Result<Tensor>
fn cos(&mut self, input: &Tensor) -> Result<Tensor>
fn tanh(&mut self, input: &Tensor) -> Result<Tensor>
fn sqrt(&mut self, input: &Tensor) -> Result<Tensor>
fn rsqrt(&mut self, input: &Tensor) -> Result<Tensor>
fn pow(&mut self, lhs: &Tensor, rhs: &Tensor) -> Result<Tensor>
fn expm1(&mut self, input: &Tensor) -> Result<Tensor>
fn log1p(&mut self, input: &Tensor) -> Result<Tensor>
fn transpose(&mut self, input: &Tensor, perm: &[usize]) -> Result<Tensor>
fn reshape(&mut self, input: &Tensor, shape: &[usize]) -> Result<Tensor>
fn broadcast_in_dim( &mut self, input: &Tensor, shape: &[usize], dims: &[usize], ) -> Result<Tensor>
fn convert(&mut self, input: &Tensor, to: DType) -> Result<Tensor>
fn extract_diagonal( &mut self, input: &Tensor, axis_a: usize, axis_b: usize, ) -> Result<Tensor>
fn embed_diagonal( &mut self, input: &Tensor, axis_a: usize, axis_b: usize, ) -> Result<Tensor>
fn tril(&mut self, input: &Tensor, k: i64) -> Result<Tensor>
fn triu(&mut self, input: &Tensor, k: i64) -> Result<Tensor>
fn reduce_sum(&mut self, input: &Tensor, axes: &[usize]) -> Result<Tensor>
fn reduce_prod(&mut self, input: &Tensor, axes: &[usize]) -> Result<Tensor>
fn reduce_max(&mut self, input: &Tensor, axes: &[usize]) -> Result<Tensor>
fn reduce_min(&mut self, input: &Tensor, axes: &[usize]) -> Result<Tensor>
fn dot_general( &mut self, lhs: &Tensor, rhs: &Tensor, config: &DotGeneralConfig, ) -> Result<Tensor>
fn gather( &mut self, operand: &Tensor, start_indices: &Tensor, config: &GatherConfig, ) -> Result<Tensor>
fn scatter( &mut self, operand: &Tensor, scatter_indices: &Tensor, updates: &Tensor, config: &ScatterConfig, ) -> Result<Tensor>
fn slice(&mut self, input: &Tensor, config: &SliceConfig) -> Result<Tensor>
fn dynamic_slice( &mut self, input: &Tensor, starts: &Tensor, slice_sizes: &[usize], ) -> Result<Tensor>
fn pad(&mut self, input: &Tensor, config: &PadConfig) -> Result<Tensor>
fn concatenate(&mut self, inputs: &[&Tensor], axis: usize) -> Result<Tensor>
fn reverse(&mut self, input: &Tensor, axes: &[usize]) -> Result<Tensor>
fn cholesky(&mut self, input: &Tensor) -> Result<Tensor>
fn triangular_solve( &mut self, a: &Tensor, b: &Tensor, left_side: bool, lower: bool, transpose_a: bool, unit_diagonal: bool, ) -> Result<Tensor>
fn lu(&mut self, input: &Tensor) -> Result<Vec<Tensor>>
fn svd(&mut self, input: &Tensor) -> Result<Vec<Tensor>>
fn qr(&mut self, input: &Tensor) -> Result<Vec<Tensor>>
fn eigh(&mut self, input: &Tensor) -> Result<Vec<Tensor>>
fn eig(&mut self, input: &Tensor) -> Result<Vec<Tensor>>
fn solve(&mut self, a: &Tensor, b: &Tensor) -> Result<Tensor>
Source§fn with_exec_session<R: Send>(
&mut self,
f: impl FnOnce(&mut dyn TensorExec) -> R + Send,
) -> R
fn with_exec_session<R: Send>( &mut self, f: impl FnOnce(&mut dyn TensorExec) -> R + Send, ) -> R
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