Skip to main content

default_cpu_execution_context

Function default_cpu_execution_context 

Source
pub fn default_cpu_execution_context() -> Arc<CpuExecutionContext>
Expand description

Borrow the process-global CPU execution context.

Compatibility entry for CPU-global convenience APIs (e.g. the legacy context-free SRC entry): host tensors constructed through the global default belong to this exact context, so they validate against it. New code must take a caller-owned context instead of consulting this.

ยงExamples

use tensor4all_tensorbackend::{default_cpu_execution_context, ExecutionContext};

let context = ExecutionContext::Cpu(default_cpu_execution_context());
assert!(matches!(context, ExecutionContext::Cpu(_)));