pub struct CpuEngine { /* private fields */ }Expand description
A caller-held CPU execution engine.
The engine owns one threadteam::Pool (or none for CpuEngine::serial) and the
workspace operations write: the buffer pool that recycles outputs, the
contraction scratch, and a handle to a CpuPlanCache. It implements
tenferro_tensor::Engine, so every operation takes it as &mut.
§Examples
use tenferro_cpu::CpuEngine;
use tenferro_tensor::{Tensor, TensorElementwise, TensorRead};
let mut engine = CpuEngine::serial();
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 = engine.add_read(TensorRead::from_tensor(&a), TensorRead::from_tensor(&b))?;
assert_eq!(c.as_slice::<f64>()?, &[4.0, 6.0]);Implementations§
Source§impl CpuEngine
impl CpuEngine
Sourcepub fn new(pool: Pool) -> Self
pub fn new(pool: Pool) -> Self
An engine that computes on pool, which it takes over.
Every operation may use all workers of the pool; a caller that wants
fewer threads builds a smaller pool. Pool::builder
reserves the worker stack the providers need by default.
§Examples
let pool = tenferro_cpu::Pool::builder().threads(4).build()?;
let engine = tenferro_cpu::CpuEngine::new(pool);
assert_eq!(engine.num_threads(), 4);Sourcepub fn serial() -> Self
pub fn serial() -> Self
An engine with no pool: every operation runs on the calling thread.
A serial engine never starts or enters a pool, so it is safe to use from inside any other pool.
§Examples
let engine = tenferro_cpu::CpuEngine::serial();
assert_eq!(engine.num_threads(), 1);Sourcepub fn with_plan_cache(self, plans: CpuPlanCache) -> Self
pub fn with_plan_cache(self, plans: CpuPlanCache) -> Self
Use plans as this engine’s plan cache, shared with every other engine
that holds a clone of it.
§Examples
use tenferro_cpu::{CpuEngine, CpuPlanCache};
let plans = CpuPlanCache::new();
let engine = CpuEngine::serial().with_plan_cache(plans.clone());
assert!(engine.plan_cache().shares_with(&plans));Sourcepub fn plan_cache(&self) -> &CpuPlanCache
pub fn plan_cache(&self) -> &CpuPlanCache
The plan cache this engine reads plans from.
§Examples
let engine = tenferro_cpu::CpuEngine::serial();
assert_eq!(engine.plan_cache().stats().entries, 0);Sourcepub fn with_runtime_engine_id(self, id: EngineId) -> Self
pub fn with_runtime_engine_id(self, id: EngineId) -> Self
Run prepared programs under a runtime engine id other than the default
crate::runtime_engine_id; it must match the id this engine kind was
registered under.
§Examples
use tenferro_runtime::EngineId;
let id = EngineId::new("example.cpu.v1")?;
let engine = tenferro_cpu::CpuEngine::serial().with_runtime_engine_id(id.clone());
assert_eq!(tenferro_runtime::ExecutionEngine::target(&engine).engine_id(), &id);Sourcepub fn with_allocation_domain(
self,
domain: Arc<dyn SharedTensorAllocationDomain>,
) -> Self
pub fn with_allocation_domain( self, domain: Arc<dyn SharedTensorAllocationDomain>, ) -> Self
Bind outputs and managed inputs to a shared allocation domain.
§Examples
let engine = tenferro_cpu::CpuEngine::serial();
assert!(engine.allocation_domain().is_none());Sourcepub fn allocation_domain(&self) -> Option<AllocationDomainId>
pub fn allocation_domain(&self) -> Option<AllocationDomainId>
The shared allocation domain this engine is bound to, if any.
§Examples
assert_eq!(tenferro_cpu::CpuEngine::serial().allocation_domain(), None);The shared allocator this engine is bound to, if any.
§Examples
assert!(tenferro_cpu::CpuEngine::serial().shared_allocation_domain().is_none());Sourcepub fn with_batch_policy(self, policy: CpuBatchPolicy) -> Self
pub fn with_batch_policy(self, policy: CpuBatchPolicy) -> Self
This engine with a different default batch policy.
§Examples
use tenferro_cpu::{CpuBatchPolicy, CpuBatchStrategy, CpuEngine};
let engine = CpuEngine::serial()
.with_batch_policy(CpuBatchPolicy::new(CpuBatchStrategy::Sequential));
assert_eq!(engine.batch_policy().strategy, CpuBatchStrategy::Sequential);Sourcepub fn set_batch_policy(&mut self, policy: CpuBatchPolicy) -> CpuBatchPolicy
pub fn set_batch_policy(&mut self, policy: CpuBatchPolicy) -> CpuBatchPolicy
Replace the default batch policy, returning the previous one.
For a one-operation override use crate::with_batch_policy.
§Examples
use tenferro_cpu::{CpuBatchPolicy, CpuBatchStrategy, CpuEngine};
let mut engine = CpuEngine::serial();
let previous = engine.set_batch_policy(CpuBatchPolicy::new(CpuBatchStrategy::Outer));
assert_eq!(previous.strategy, CpuBatchStrategy::Auto);Sourcepub fn batch_policy(&self) -> CpuBatchPolicy
pub fn batch_policy(&self) -> CpuBatchPolicy
The default batch policy of this engine.
§Examples
use tenferro_cpu::{CpuBatchStrategy, CpuEngine};
assert_eq!(CpuEngine::serial().batch_policy().strategy, CpuBatchStrategy::Auto);Sourcepub fn num_threads(&self) -> usize
pub fn num_threads(&self) -> usize
The number of workers operations may use: the pool size, or one.
§Examples
assert_eq!(tenferro_cpu::CpuEngine::serial().num_threads(), 1);Sourcepub fn has_team(&self) -> bool
pub fn has_team(&self) -> bool
Whether the engine runs its parallel work on a reserved
threadteam::Team.
true for an engine built from a pool of two or more workers whose
members were reserved. false for CpuEngine::serial, for a
one-worker pool, and for a pool whose members could not be reserved
within about ten seconds of construction (the engine then runs serially
and CpuEngine::num_threads reports one). Benchmarks should assert
this after construction.
§Examples
assert!(!tenferro_cpu::CpuEngine::serial().has_team());
let pool = tenferro_cpu::Pool::builder().threads(2).build()?;
assert!(tenferro_cpu::CpuEngine::new(pool).has_team());Sourcepub fn is_broken(&self) -> bool
pub fn is_broken(&self) -> bool
Whether an earlier operation broke this engine (see
CpuEngineError::Broken).
§Examples
assert!(!tenferro_cpu::CpuEngine::serial().is_broken());Sourcepub fn exec(&mut self) -> Result<Exec<'_>>
pub fn exec(&mut self) -> Result<Exec<'_>>
The provider execution bundle for this engine: a placement token over every worker of its pool, its workspace and its batch policy.
A downstream kernel that calls a provider (cpueinsum, tcontract,
tlinalg) directly passes this bundle by &mut, so it uses the same
threads, budget and batch policy as tenferro. The bundle is not Clone:
it is the engine’s whole thread budget for that one call, and the provider
splits it. Getting it applies the same checks as an operation.
§Errors
Returns crate::Error::RuntimeState with a CpuEngineError source
when the engine is broken.
§Examples
let mut engine = tenferro_cpu::CpuEngine::serial();
let exec = engine.exec()?;
assert_eq!(exec.budget(), 1);Sourcepub fn buffer_pool_len(&self) -> usize
pub fn buffer_pool_len(&self) -> usize
Number of retained buffers in the engine’s buffer pool.
§Examples
assert_eq!(tenferro_cpu::CpuEngine::serial().buffer_pool_len(), 0);Sourcepub fn buffer_pool_stats(&self) -> BufferPoolStats
pub fn buffer_pool_stats(&self) -> BufferPoolStats
Retained-buffer statistics of the engine’s buffer pool.
§Examples
assert_eq!(tenferro_cpu::CpuEngine::serial().buffer_pool_stats().buffers, 0);Sourcepub fn buffer_pool_cache_stats(&self) -> CacheStats
pub fn buffer_pool_cache_stats(&self) -> CacheStats
The buffer pool as cache statistics (entries and retained bytes).
§Examples
assert_eq!(tenferro_cpu::CpuEngine::serial().buffer_pool_cache_stats().entries, 0);Sourcepub fn buffer_pool_limit_bytes(&self) -> usize
pub fn buffer_pool_limit_bytes(&self) -> usize
The retention limit of recycled buffers, in retained capacity bytes.
§Examples
let mut engine = tenferro_cpu::CpuEngine::serial();
engine.set_buffer_pool_limit_bytes(0);
assert_eq!(engine.buffer_pool_limit_bytes(), 0);Sourcepub fn set_buffer_pool_limit_bytes(
&mut self,
max_retained_capacity_bytes: usize,
)
pub fn set_buffer_pool_limit_bytes( &mut self, max_retained_capacity_bytes: usize, )
Bound the bytes of recycled buffers and contraction scratch retained between operations; zero disables retention.
Destinations larger than the retention limit cannot be recycled, so repeated calls allocate again and may pay first-touch costs. The default is 100 MiB; raise it when a run keeps producing outputs above that size.
§Examples
let mut engine = tenferro_cpu::CpuEngine::serial();
engine.set_buffer_pool_limit_bytes(1 << 20);
assert_eq!(engine.buffer_pool_limit_bytes(), 1 << 20);Sourcepub fn reset_buffer_pool(&mut self)
pub fn reset_buffer_pool(&mut self)
Drop every retained buffer and contraction scratch.
§Examples
let mut engine = tenferro_cpu::CpuEngine::serial();
engine.reset_buffer_pool();
assert_eq!(engine.buffer_pool_len(), 0);Trait Implementations§
Source§impl Engine for CpuEngine
impl Engine for CpuEngine
Source§fn gather_read(
&mut self,
operand: TensorRead<'_>,
start_indices: TensorRead<'_>,
config: &GatherConfig,
) -> Result<Tensor>
fn gather_read( &mut self, operand: TensorRead<'_>, start_indices: TensorRead<'_>, config: &GatherConfig, ) -> Result<Tensor>
Source§fn vdot_read(
&mut self,
lhs: TensorRead<'_>,
rhs: TensorRead<'_>,
) -> Result<Tensor>
fn vdot_read( &mut self, lhs: TensorRead<'_>, rhs: TensorRead<'_>, ) -> Result<Tensor>
Source§fn norm_squared_read(&mut self, input: TensorRead<'_>) -> Result<Tensor>
fn norm_squared_read(&mut self, input: TensorRead<'_>) -> Result<Tensor>
Source§fn fused_activation_read(
&mut self,
op: ActivationOp,
input: TensorRead<'_>,
) -> Result<Option<Tensor>>
fn fused_activation_read( &mut self, op: ActivationOp, input: TensorRead<'_>, ) -> Result<Option<Tensor>>
Ok(None). Read moreSource§fn softmax_read(
&mut self,
input: TensorRead<'_>,
axis: usize,
) -> Result<Option<Tensor>>
fn softmax_read( &mut self, input: TensorRead<'_>, axis: usize, ) -> Result<Option<Tensor>>
axis. Read moreSource§fn axpby_read_into_accum(
&mut self,
alpha: ContractionScalar,
x: TensorRead<'_>,
beta: ContractionScalar,
y: TensorWrite<'_>,
) -> Result<()>
fn axpby_read_into_accum( &mut self, alpha: ContractionScalar, x: TensorRead<'_>, beta: ContractionScalar, y: TensorWrite<'_>, ) -> Result<()>
y <- alpha * x + beta * y in one pass into caller-owned storage. Read moreSource§fn native_engine(&mut self) -> Option<NativeSessionRef<'_>>
fn native_engine(&mut self) -> Option<NativeSessionRef<'_>>
Source§impl ExecutionEngine for CpuEngine
impl ExecutionEngine for CpuEngine
Source§fn target(&self) -> EngineTarget
fn target(&self) -> EngineTarget
crate::Runtime::prepare.Source§fn take_extension_caches(&mut self) -> ExtensionCacheStore
fn take_extension_caches(&mut self) -> ExtensionCacheStore
Source§fn restore_extension_caches(&mut self, caches: ExtensionCacheStore)
fn restore_extension_caches(&mut self, caches: ExtensionCacheStore)
Self::take_extension_caches.Source§fn mark_broken(&mut self)
fn mark_broken(&mut self)
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Engine operations.Source§fn event_domain_driver(&self) -> Arc<dyn EventDomainDriver> ⓘ
fn event_domain_driver(&self) -> Arc<dyn EventDomainDriver> ⓘ
Source§fn retire_run(&mut self, run: Box<dyn EventDomainRun>) -> Result<(), Error>
fn retire_run(&mut self, run: Box<dyn EventDomainRun>) -> Result<(), Error>
Source§impl SessionCachedDot for CpuEngine
impl SessionCachedDot for CpuEngine
Source§fn dot_general_read_into_accum_cached(
&mut self,
cache_slot: Option<usize>,
lhs: TensorRead<'_>,
rhs: TensorRead<'_>,
config: &DotGeneralConfig,
accumulation: DotGeneralAccumulation,
out: TensorWrite<'_>,
) -> Result<()>
fn dot_general_read_into_accum_cached( &mut self, cache_slot: Option<usize>, lhs: TensorRead<'_>, rhs: TensorRead<'_>, config: &DotGeneralConfig, accumulation: DotGeneralAccumulation, out: TensorWrite<'_>, ) -> Result<()>
Source§impl TensorAnalytic for CpuEngine
impl TensorAnalytic for CpuEngine
Source§fn rsqrt_read(&mut self, input: TensorRead<'_>) -> Result<Tensor>
fn rsqrt_read(&mut self, input: TensorRead<'_>) -> Result<Tensor>
Source§fn pow_read(
&mut self,
lhs: TensorRead<'_>,
rhs: TensorRead<'_>,
) -> Result<Tensor>
fn pow_read( &mut self, lhs: TensorRead<'_>, rhs: TensorRead<'_>, ) -> Result<Tensor>
Source§fn expm1_read(&mut self, input: TensorRead<'_>) -> Result<Tensor>
fn expm1_read(&mut self, input: TensorRead<'_>) -> Result<Tensor>
Source§fn log1p_read(&mut self, input: TensorRead<'_>) -> Result<Tensor>
fn log1p_read(&mut self, input: TensorRead<'_>) -> Result<Tensor>
Source§impl TensorBackendCapability for CpuEngine
impl TensorBackendCapability for CpuEngine
fn backend_id(&self) -> BackendId
fn capabilities(&self) -> &'static [OperationCapability]
Source§fn capability(&self, query: CapabilityQuery) -> Option<OperationCapability>
fn capability(&self, query: CapabilityQuery) -> Option<OperationCapability>
Source§fn require_capability(
&self,
query: CapabilityQuery,
axis: CapabilityAxis,
) -> Result<OperationCapability, Error>
fn require_capability( &self, query: CapabilityQuery, axis: CapabilityAxis, ) -> Result<OperationCapability, Error>
Source§impl TensorBuffer for CpuEngine
impl TensorBuffer for CpuEngine
fn reclaim_buffer(&mut self, tensor: Tensor)
Source§impl TensorDeviceTransfer for CpuEngine
impl TensorDeviceTransfer for CpuEngine
Source§fn download_to_host(&mut self, tensor: TensorRead<'_>) -> Result<Tensor>
fn download_to_host(&mut self, tensor: TensorRead<'_>) -> Result<Tensor>
Source§fn upload_host_tensor(&mut self, tensor: TensorRead<'_>) -> Result<Tensor>
fn upload_host_tensor(&mut self, tensor: TensorRead<'_>) -> Result<Tensor>
Source§impl TensorDot for CpuEngine
impl TensorDot for CpuEngine
Source§fn dot_general_read_into(
&mut self,
lhs: TensorRead<'_>,
rhs: TensorRead<'_>,
config: &DotGeneralConfig,
out: TensorWrite<'_>,
) -> Result<()>
fn dot_general_read_into( &mut self, lhs: TensorRead<'_>, rhs: TensorRead<'_>, config: &DotGeneralConfig, out: TensorWrite<'_>, ) -> Result<()>
Source§fn dot_general_read_into_accum(
&mut self,
lhs: TensorRead<'_>,
rhs: TensorRead<'_>,
config: &DotGeneralConfig,
accumulation: DotGeneralAccumulation,
out: TensorWrite<'_>,
) -> Result<()>
fn dot_general_read_into_accum( &mut self, lhs: TensorRead<'_>, rhs: TensorRead<'_>, config: &DotGeneralConfig, accumulation: DotGeneralAccumulation, out: TensorWrite<'_>, ) -> Result<()>
Source§impl TensorElementwise for CpuEngine
impl TensorElementwise for CpuEngine
Source§fn elementwise_read_into(
&mut self,
op: ElementwiseReadOp,
inputs: &[TensorRead<'_>],
out: TensorWrite<'_>,
) -> Result<()>
fn elementwise_read_into( &mut self, op: ElementwiseReadOp, inputs: &[TensorRead<'_>], out: TensorWrite<'_>, ) -> Result<()>
Source§fn add_read(
&mut self,
lhs: TensorRead<'_>,
rhs: TensorRead<'_>,
) -> Result<Tensor>
fn add_read( &mut self, lhs: TensorRead<'_>, rhs: TensorRead<'_>, ) -> Result<Tensor>
Source§fn sub_read(
&mut self,
lhs: TensorRead<'_>,
rhs: TensorRead<'_>,
) -> Result<Tensor>
fn sub_read( &mut self, lhs: TensorRead<'_>, rhs: TensorRead<'_>, ) -> Result<Tensor>
Source§fn mul_read(
&mut self,
lhs: TensorRead<'_>,
rhs: TensorRead<'_>,
) -> Result<Tensor>
fn mul_read( &mut self, lhs: TensorRead<'_>, rhs: TensorRead<'_>, ) -> Result<Tensor>
Source§fn div_read(
&mut self,
lhs: TensorRead<'_>,
rhs: TensorRead<'_>,
) -> Result<Tensor>
fn div_read( &mut self, lhs: TensorRead<'_>, rhs: TensorRead<'_>, ) -> Result<Tensor>
Source§fn rem(&mut self, lhs: &Tensor, rhs: &Tensor) -> Result<Tensor>
fn rem(&mut self, lhs: &Tensor, rhs: &Tensor) -> Result<Tensor>
Source§fn rem_read(
&mut self,
lhs: TensorRead<'_>,
rhs: TensorRead<'_>,
) -> Result<Tensor>
fn rem_read( &mut self, lhs: TensorRead<'_>, rhs: TensorRead<'_>, ) -> Result<Tensor>
Source§fn maximum_read(
&mut self,
lhs: TensorRead<'_>,
rhs: TensorRead<'_>,
) -> Result<Tensor>
fn maximum_read( &mut self, lhs: TensorRead<'_>, rhs: TensorRead<'_>, ) -> Result<Tensor>
Source§fn minimum_read(
&mut self,
lhs: TensorRead<'_>,
rhs: TensorRead<'_>,
) -> Result<Tensor>
fn minimum_read( &mut self, lhs: TensorRead<'_>, rhs: TensorRead<'_>, ) -> Result<Tensor>
Source§fn compare_read(
&mut self,
lhs: TensorRead<'_>,
rhs: TensorRead<'_>,
dir: &CompareDir,
) -> Result<Tensor>
fn compare_read( &mut self, lhs: TensorRead<'_>, rhs: TensorRead<'_>, dir: &CompareDir, ) -> Result<Tensor>
Source§fn select_read(
&mut self,
pred: TensorRead<'_>,
on_true: TensorRead<'_>,
on_false: TensorRead<'_>,
) -> Result<Tensor>
fn select_read( &mut self, pred: TensorRead<'_>, on_true: TensorRead<'_>, on_false: TensorRead<'_>, ) -> Result<Tensor>
Source§fn clamp_read(
&mut self,
input: TensorRead<'_>,
lower: TensorRead<'_>,
upper: TensorRead<'_>,
) -> Result<Tensor>
fn clamp_read( &mut self, input: TensorRead<'_>, lower: TensorRead<'_>, upper: TensorRead<'_>, ) -> Result<Tensor>
Source§fn add_into(
&mut self,
lhs: &Tensor,
rhs: &Tensor,
out: TensorWrite<'_>,
) -> Result<(), Error>
fn add_into( &mut self, lhs: &Tensor, rhs: &Tensor, out: TensorWrite<'_>, ) -> Result<(), Error>
Source§fn add_read_into(
&mut self,
lhs: TensorRead<'_>,
rhs: TensorRead<'_>,
out: TensorWrite<'_>,
) -> Result<(), Error>
fn add_read_into( &mut self, lhs: TensorRead<'_>, rhs: TensorRead<'_>, out: TensorWrite<'_>, ) -> Result<(), Error>
Source§fn sub_into(
&mut self,
lhs: &Tensor,
rhs: &Tensor,
out: TensorWrite<'_>,
) -> Result<(), Error>
fn sub_into( &mut self, lhs: &Tensor, rhs: &Tensor, out: TensorWrite<'_>, ) -> Result<(), Error>
Source§fn sub_read_into(
&mut self,
lhs: TensorRead<'_>,
rhs: TensorRead<'_>,
out: TensorWrite<'_>,
) -> Result<(), Error>
fn sub_read_into( &mut self, lhs: TensorRead<'_>, rhs: TensorRead<'_>, out: TensorWrite<'_>, ) -> Result<(), Error>
Source§fn mul_into(
&mut self,
lhs: &Tensor,
rhs: &Tensor,
out: TensorWrite<'_>,
) -> Result<(), Error>
fn mul_into( &mut self, lhs: &Tensor, rhs: &Tensor, out: TensorWrite<'_>, ) -> Result<(), Error>
Source§fn mul_read_into(
&mut self,
lhs: TensorRead<'_>,
rhs: TensorRead<'_>,
out: TensorWrite<'_>,
) -> Result<(), Error>
fn mul_read_into( &mut self, lhs: TensorRead<'_>, rhs: TensorRead<'_>, out: TensorWrite<'_>, ) -> Result<(), Error>
Source§fn neg_into(
&mut self,
input: &Tensor,
out: TensorWrite<'_>,
) -> Result<(), Error>
fn neg_into( &mut self, input: &Tensor, out: TensorWrite<'_>, ) -> Result<(), Error>
Source§fn neg_read_into(
&mut self,
input: TensorRead<'_>,
out: TensorWrite<'_>,
) -> Result<(), Error>
fn neg_read_into( &mut self, input: TensorRead<'_>, out: TensorWrite<'_>, ) -> Result<(), Error>
Source§fn conj_into(
&mut self,
input: &Tensor,
out: TensorWrite<'_>,
) -> Result<(), Error>
fn conj_into( &mut self, input: &Tensor, out: TensorWrite<'_>, ) -> Result<(), Error>
Source§fn conj_read_into(
&mut self,
input: TensorRead<'_>,
out: TensorWrite<'_>,
) -> Result<(), Error>
fn conj_read_into( &mut self, input: TensorRead<'_>, out: TensorWrite<'_>, ) -> Result<(), Error>
Source§fn div_into(
&mut self,
lhs: &Tensor,
rhs: &Tensor,
out: TensorWrite<'_>,
) -> Result<(), Error>
fn div_into( &mut self, lhs: &Tensor, rhs: &Tensor, out: TensorWrite<'_>, ) -> Result<(), Error>
Source§fn div_read_into(
&mut self,
lhs: TensorRead<'_>,
rhs: TensorRead<'_>,
out: TensorWrite<'_>,
) -> Result<(), Error>
fn div_read_into( &mut self, lhs: TensorRead<'_>, rhs: TensorRead<'_>, out: TensorWrite<'_>, ) -> Result<(), Error>
impl TensorFusion for CpuEngine
Source§impl TensorIndexing for CpuEngine
impl TensorIndexing for CpuEngine
Source§fn gather(
&mut self,
operand: &Tensor,
start_indices: &Tensor,
config: &GatherConfig,
) -> Result<Tensor>
fn gather( &mut self, operand: &Tensor, start_indices: &Tensor, config: &GatherConfig, ) -> Result<Tensor>
Source§fn scatter(
&mut self,
operand: &Tensor,
indices: &Tensor,
updates: &Tensor,
config: &ScatterConfig,
) -> Result<Tensor>
fn scatter( &mut self, operand: &Tensor, indices: &Tensor, updates: &Tensor, config: &ScatterConfig, ) -> Result<Tensor>
Source§fn dynamic_update_slice_read(
&mut self,
operand: TensorRead<'_>,
update: TensorRead<'_>,
starts: TensorRead<'_>,
) -> Result<Tensor>
fn dynamic_update_slice_read( &mut self, operand: TensorRead<'_>, update: TensorRead<'_>, starts: TensorRead<'_>, ) -> Result<Tensor>
Source§fn scatter_read(
&mut self,
operand: TensorRead<'_>,
indices: TensorRead<'_>,
updates: TensorRead<'_>,
config: &ScatterConfig,
) -> Result<Tensor>
fn scatter_read( &mut self, operand: TensorRead<'_>, indices: TensorRead<'_>, updates: TensorRead<'_>, config: &ScatterConfig, ) -> Result<Tensor>
Source§fn slice_read(
&mut self,
input: TensorRead<'_>,
config: &SliceConfig,
) -> Result<Tensor>
fn slice_read( &mut self, input: TensorRead<'_>, config: &SliceConfig, ) -> Result<Tensor>
Source§fn dynamic_slice_read(
&mut self,
input: TensorRead<'_>,
starts: TensorRead<'_>,
slice_sizes: &[usize],
) -> Result<Tensor>
fn dynamic_slice_read( &mut self, input: TensorRead<'_>, starts: TensorRead<'_>, slice_sizes: &[usize], ) -> Result<Tensor>
Source§fn dynamic_slice(
&mut self,
input: &Tensor,
starts: &Tensor,
slice_sizes: &[usize],
) -> Result<Tensor>
fn dynamic_slice( &mut self, input: &Tensor, starts: &Tensor, slice_sizes: &[usize], ) -> Result<Tensor>
Source§fn dynamic_update_slice(
&mut self,
operand: &Tensor,
update: &Tensor,
starts: &Tensor,
) -> Result<Tensor>
fn dynamic_update_slice( &mut self, operand: &Tensor, update: &Tensor, starts: &Tensor, ) -> Result<Tensor>
Source§fn pad_read(
&mut self,
input: TensorRead<'_>,
config: &PadConfig,
) -> Result<Tensor>
fn pad_read( &mut self, input: TensorRead<'_>, config: &PadConfig, ) -> Result<Tensor>
Source§fn concatenate_read(
&mut self,
inputs: &[TensorRead<'_>],
axis: usize,
) -> Result<Tensor>
fn concatenate_read( &mut self, inputs: &[TensorRead<'_>], axis: usize, ) -> Result<Tensor>
Source§fn reverse_read(
&mut self,
input: TensorRead<'_>,
axes: &[usize],
) -> Result<Tensor>
fn reverse_read( &mut self, input: TensorRead<'_>, axes: &[usize], ) -> Result<Tensor>
Source§impl TensorReduction for CpuEngine
impl TensorReduction for CpuEngine
Source§fn reduce_sum_read(
&mut self,
input: TensorRead<'_>,
axes: &[usize],
) -> Result<Tensor>
fn reduce_sum_read( &mut self, input: TensorRead<'_>, axes: &[usize], ) -> Result<Tensor>
Source§fn reduce_prod_read(
&mut self,
input: TensorRead<'_>,
axes: &[usize],
) -> Result<Tensor>
fn reduce_prod_read( &mut self, input: TensorRead<'_>, axes: &[usize], ) -> Result<Tensor>
Source§fn reduce_max_read(
&mut self,
input: TensorRead<'_>,
axes: &[usize],
) -> Result<Tensor>
fn reduce_max_read( &mut self, input: TensorRead<'_>, axes: &[usize], ) -> Result<Tensor>
Source§fn reduce_min_read(
&mut self,
input: TensorRead<'_>,
axes: &[usize],
) -> Result<Tensor>
fn reduce_min_read( &mut self, input: TensorRead<'_>, axes: &[usize], ) -> Result<Tensor>
Source§impl TensorStructural for CpuEngine
impl TensorStructural for CpuEngine
Source§fn to_contiguous_read(&mut self, input: TensorRead<'_>) -> Result<Tensor>
fn to_contiguous_read(&mut self, input: TensorRead<'_>) -> Result<Tensor>
Source§fn copy_read_into(
&mut self,
src: TensorRead<'_>,
dst: TensorWrite<'_>,
) -> Result<()>
fn copy_read_into( &mut self, src: TensorRead<'_>, dst: TensorWrite<'_>, ) -> Result<()>
Source§fn transpose_read(
&mut self,
input: TensorRead<'_>,
perm: &[usize],
) -> Result<Tensor>
fn transpose_read( &mut self, input: TensorRead<'_>, perm: &[usize], ) -> Result<Tensor>
Source§fn reshape_read(
&mut self,
input: TensorRead<'_>,
shape: &[usize],
) -> Result<Tensor>
fn reshape_read( &mut self, input: TensorRead<'_>, shape: &[usize], ) -> Result<Tensor>
Source§fn broadcast_in_dim_read(
&mut self,
input: TensorRead<'_>,
shape: &[usize],
dims: &[usize],
) -> Result<Tensor>
fn broadcast_in_dim_read( &mut self, input: TensorRead<'_>, shape: &[usize], dims: &[usize], ) -> Result<Tensor>
Source§fn tril_read(&mut self, input: TensorRead<'_>, k: i64) -> Result<Tensor>
fn tril_read(&mut self, input: TensorRead<'_>, k: i64) -> Result<Tensor>
Source§fn triu_read(&mut self, input: TensorRead<'_>, k: i64) -> Result<Tensor>
fn triu_read(&mut self, input: TensorRead<'_>, k: i64) -> Result<Tensor>
Source§fn extract_diagonal_read(
&mut self,
input: TensorRead<'_>,
axis_a: usize,
axis_b: usize,
) -> Result<Tensor>
fn extract_diagonal_read( &mut self, input: TensorRead<'_>, axis_a: usize, axis_b: usize, ) -> Result<Tensor>
Source§fn embed_diagonal_read(
&mut self,
input: TensorRead<'_>,
axis_a: usize,
axis_b: usize,
) -> Result<Tensor>
fn embed_diagonal_read( &mut self, input: TensorRead<'_>, axis_a: usize, axis_b: usize, ) -> Result<Tensor>
Source§fn cast(&mut self, input: &Tensor, to: DType) -> Result<Tensor>
fn cast(&mut self, input: &Tensor, to: DType) -> Result<Tensor>
Source§fn extract_diagonal(
&mut self,
input: &Tensor,
axis_a: usize,
axis_b: usize,
) -> Result<Tensor>
fn extract_diagonal( &mut self, input: &Tensor, axis_a: usize, axis_b: usize, ) -> Result<Tensor>
Source§impl<T, R> TensorViewCanonicalization<T, R> for CpuEngine
Typed view canonicalization runs on the engine.
impl<T, R> TensorViewCanonicalization<T, R> for CpuEngine
Typed view canonicalization runs on the engine.
Source§fn to_contiguous(
&mut self,
view: &TypedTensorView<'_, T, R>,
) -> Result<TypedTensor<T, R>>
fn to_contiguous( &mut self, view: &TypedTensorView<'_, T, R>, ) -> Result<TypedTensor<T, R>>
Source§fn copy_into(
&mut self,
src: &TypedTensorView<'_, T, R>,
dst: &mut TypedTensorViewMut<'_, T, R>,
) -> Result<()>
fn copy_into( &mut self, src: &TypedTensorView<'_, T, R>, dst: &mut TypedTensorViewMut<'_, T, R>, ) -> Result<()>
Auto Trait Implementations§
impl !Freeze for CpuEngine
impl !RefUnwindSafe for CpuEngine
impl !UnwindSafe for CpuEngine
impl Send for CpuEngine
impl Sync for CpuEngine
impl Unpin for CpuEngine
impl UnsafeUnpin for CpuEngine
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
impl<T, U> Imply<T> for U
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> ⓘ
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> ⓘ
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