Skip to main content

Crate tenferro_cpu

Crate tenferro_cpu 

Source
Expand description

CPU backend, kernels, provider selection, and CPU resource pools.

§Examples

use tenferro_cpu::{add, CpuBackend};
use tenferro_tensor::{Tensor, TensorBackend, TensorElementwise};

let mut backend = CpuBackend::new();
let a = Tensor::from_vec_col_major(vec![2], vec![1.0_f64, 2.0])?;
let b = Tensor::from_vec_col_major(vec![2], vec![3.0_f64, 4.0])?;
let c = backend.add(&a, &b)?;
assert_eq!(c.as_slice::<f64>().unwrap(), &[4.0, 6.0]);
let direct = add(&a, &b)?;
assert_eq!(direct.shape(), &[2]);

Re-exports§

pub use affinity::available_parallelism;
pub use affinity::process_cpu_affinity_count;
pub use backend::CpuBackend;
pub use backend::CpuBackendKind;
pub use context::CpuContext;

Modules§

affinity
backend
context

Structs§

BufferPoolStats
Snapshot of typed host buffers retained by a [BufferPool].

Functions§

abs
Compute elementwise absolute values.
add
Add two CPU tensors elementwise.
broadcast_in_dim
clamp
Clamp CPU tensor values elementwise between lower and upper bounds.
compare
Compare two CPU tensors elementwise.
conj
Conjugate a real or complex CPU tensor elementwise.
convert
Convert a tensor to another dtype using checked dtype conversion.
div
Divide two CPU tensors elementwise.
dynamic_slice
dynamic_update_slice
Return operand with update written at dynamic starts.
embed_diagonal
extract_diagonal
gather
maximum
Compute elementwise maximum values.
minimum
Compute elementwise minimum values.
mul
Multiply two CPU tensors elementwise.
neg
Negate a CPU tensor elementwise.
pad
reduce_max
reduce_min
reduce_prod
reduce_sum
reshape
scatter
select
Select values from two tensors using a boolean predicate tensor.
sign
Compute elementwise signs.
transpose
tril
triu