pub struct Scirs2Exec {
pub tensors: HashMap<String, Scirs2Tensor>,
/* private fields */
}Fields§
§tensors: HashMap<String, Scirs2Tensor>Implementations§
Source§impl Scirs2Exec
impl Scirs2Exec
Sourcepub fn from_vec(
data: Vec<f64>,
shape: Vec<usize>,
) -> Result<Scirs2Tensor, ExecutorError>
pub fn from_vec( data: Vec<f64>, shape: Vec<usize>, ) -> Result<Scirs2Tensor, ExecutorError>
Create a tensor from a flat vector and shape.
Sourcepub fn zeros(shape: Vec<usize>) -> Scirs2Tensor
pub fn zeros(shape: Vec<usize>) -> Scirs2Tensor
Create a tensor filled with zeros.
Sourcepub fn ones(shape: Vec<usize>) -> Scirs2Tensor
pub fn ones(shape: Vec<usize>) -> Scirs2Tensor
Create a tensor filled with ones.
Source§impl Scirs2Exec
impl Scirs2Exec
pub fn new() -> Self
Sourcepub fn with_memory_pool() -> Self
pub fn with_memory_pool() -> Self
Create executor with memory pooling enabled
Sourcepub fn enable_pooling(&mut self)
pub fn enable_pooling(&mut self)
Enable memory pooling
Sourcepub fn disable_pooling(&mut self)
pub fn disable_pooling(&mut self)
Disable memory pooling
Sourcepub fn pool_stats(&self) -> Option<PoolStats>
pub fn pool_stats(&self) -> Option<PoolStats>
Get pool statistics if pooling is enabled
pub fn add_tensor(&mut self, name: impl Into<String>, tensor: Scirs2Tensor)
pub fn get_tensor(&self, name: &str) -> Option<&Scirs2Tensor>
Trait Implementations§
Source§impl Clone for Scirs2Exec
impl Clone for Scirs2Exec
Source§impl Default for Scirs2Exec
impl Default for Scirs2Exec
Source§impl TlAutodiff for Scirs2Exec
impl TlAutodiff for Scirs2Exec
Source§impl TlBatchExecutor for Scirs2Exec
impl TlBatchExecutor for Scirs2Exec
type Tensor = ArrayBase<OwnedRepr<f64>, Dim<IxDynImpl>>
type Error = ExecutorError
Source§fn execute_batch(
&mut self,
graph: &EinsumGraph,
batch_inputs: Vec<Vec<Self::Tensor>>,
) -> Result<BatchResult<Self::Tensor>, Self::Error>
fn execute_batch( &mut self, graph: &EinsumGraph, batch_inputs: Vec<Vec<Self::Tensor>>, ) -> Result<BatchResult<Self::Tensor>, Self::Error>
Execute a graph on a batch of inputs
Source§fn execute_batch_parallel(
&mut self,
graph: &EinsumGraph,
batch_inputs: Vec<Vec<Self::Tensor>>,
num_threads: Option<usize>,
) -> Result<BatchResult<Self::Tensor>, Self::Error>
fn execute_batch_parallel( &mut self, graph: &EinsumGraph, batch_inputs: Vec<Vec<Self::Tensor>>, num_threads: Option<usize>, ) -> Result<BatchResult<Self::Tensor>, Self::Error>
Execute a graph on a batch of inputs with parallel processing
Source§fn optimal_batch_size(&self) -> usize
fn optimal_batch_size(&self) -> usize
Get optimal batch size for this executor
Source§fn max_batch_size(&self) -> Option<usize>
fn max_batch_size(&self) -> Option<usize>
Get maximum recommended batch size for this executor
Source§impl TlCapabilities for Scirs2Exec
impl TlCapabilities for Scirs2Exec
Source§fn capabilities(&self) -> &BackendCapabilities
fn capabilities(&self) -> &BackendCapabilities
Get backend capabilities
Source§fn supports_elem_op(&self, op: ElemOp) -> bool
fn supports_elem_op(&self, op: ElemOp) -> bool
Check if a specific operation is supported
Source§fn supports_reduce_op(&self, op: ReduceOp) -> bool
fn supports_reduce_op(&self, op: ReduceOp) -> bool
Check if a specific reduction operation is supported
Source§fn supports_einsum(&self, spec: &str) -> bool
fn supports_einsum(&self, spec: &str) -> bool
Check if einsum is supported with the given spec
Source§fn available_devices(&self) -> Vec<DeviceType>
fn available_devices(&self) -> Vec<DeviceType>
Get available devices
Source§fn default_device(&self) -> DeviceType
fn default_device(&self) -> DeviceType
Get default device
Source§impl TlExecutor for Scirs2Exec
impl TlExecutor for Scirs2Exec
type Tensor = ArrayBase<OwnedRepr<f64>, Dim<IxDynImpl>>
type Error = ExecutorError
Source§fn einsum(
&mut self,
spec: &str,
inputs: &[Self::Tensor],
) -> Result<Self::Tensor, Self::Error>
fn einsum( &mut self, spec: &str, inputs: &[Self::Tensor], ) -> Result<Self::Tensor, Self::Error>
Execute an einsum operation on input tensors.
Source§fn elem_op(
&mut self,
op: ElemOp,
x: &Self::Tensor,
) -> Result<Self::Tensor, Self::Error>
fn elem_op( &mut self, op: ElemOp, x: &Self::Tensor, ) -> Result<Self::Tensor, Self::Error>
Apply an element-wise unary operation.
Auto Trait Implementations§
impl Freeze for Scirs2Exec
impl RefUnwindSafe for Scirs2Exec
impl Send for Scirs2Exec
impl Sync for Scirs2Exec
impl Unpin for Scirs2Exec
impl UnwindSafe for Scirs2Exec
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> 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