pub struct CpuLlmBackend;Trait Implementations§
Source§impl Clone for CpuLlmBackend
impl Clone for CpuLlmBackend
Source§fn clone(&self) -> CpuLlmBackend
fn clone(&self) -> CpuLlmBackend
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CpuLlmBackend
impl Debug for CpuLlmBackend
Source§impl Default for CpuLlmBackend
impl Default for CpuLlmBackend
Source§fn default() -> CpuLlmBackend
fn default() -> CpuLlmBackend
Returns the “default value” for a type. Read more
Source§impl LlmBackend for CpuLlmBackend
impl LlmBackend for CpuLlmBackend
fn name(&self) -> &'static str
fn linear_3d(&self, x: &Tensor, weight: &Tensor) -> Result<Tensor>
fn rms_norm(&self, x: &Tensor, weight: &Tensor, eps: f32) -> Result<Tensor>
fn layer_norm( &self, x: &Tensor, weight: &Tensor, bias: Option<&Tensor>, eps: f32, ) -> Result<Tensor>
fn silu(&self, x: &Tensor) -> Result<Tensor>
fn gelu(&self, x: &Tensor) -> Result<Tensor>
fn add(&self, a: &Tensor, b: &Tensor) -> Result<Tensor>
fn mul(&self, a: &Tensor, b: &Tensor) -> Result<Tensor>
fn apply_rope_positions( &self, x: &Tensor, positions: &[usize], base: f32, ) -> Result<Tensor>
fn gqa_attention( &self, q: &Tensor, k: &Tensor, v: &Tensor, n_kv_heads: usize, causal: bool, ) -> Result<Tensor>
Source§fn linear_3d_bias(
&self,
x: &Tensor,
weight: &Tensor,
bias: Option<&Tensor>,
) -> Result<Tensor>
fn linear_3d_bias( &self, x: &Tensor, weight: &Tensor, bias: Option<&Tensor>, ) -> Result<Tensor>
Linear projection with an optional bias added over the last dimension.
Backend-agnostic: computes
linear_3d then folds in the bias on the host,
so every backend gets correct bias handling for free.Source§fn apply_rope_partial(
&self,
x: &Tensor,
positions: &[usize],
base: f32,
rotary_dim: usize,
) -> Result<Tensor>
fn apply_rope_partial( &self, x: &Tensor, positions: &[usize], base: f32, rotary_dim: usize, ) -> Result<Tensor>
RoPE over only the first
rotary_dim channels (Phi partial rotary).
Computed on the CPU reference kernel for all backends — it is cheap and
avoids backend-specific partial-rotary support.Auto Trait Implementations§
impl Freeze for CpuLlmBackend
impl RefUnwindSafe for CpuLlmBackend
impl Send for CpuLlmBackend
impl Sync for CpuLlmBackend
impl Unpin for CpuLlmBackend
impl UnsafeUnpin for CpuLlmBackend
impl UnwindSafe for CpuLlmBackend
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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