Skip to main content

TensorIndexing

Trait TensorIndexing 

Source
pub trait TensorIndexing {
    // Required methods
    fn gather(
        &mut self,
        operand: &Tensor,
        start_indices: &Tensor,
        config: &GatherConfig,
    ) -> Result<Tensor>;
    fn scatter(
        &mut self,
        operand: &Tensor,
        scatter_indices: &Tensor,
        updates: &Tensor,
        config: &ScatterConfig,
    ) -> Result<Tensor>;
    fn slice(&mut self, input: &Tensor, config: &SliceConfig) -> Result<Tensor>;
    fn dynamic_slice(
        &mut self,
        input: &Tensor,
        starts: &Tensor,
        slice_sizes: &[usize],
    ) -> Result<Tensor>;
    fn dynamic_update_slice(
        &mut self,
        operand: &Tensor,
        update: &Tensor,
        starts: &Tensor,
    ) -> Result<Tensor>;
    fn pad(&mut self, input: &Tensor, config: &PadConfig) -> Result<Tensor>;
    fn concatenate(&mut self, inputs: &[&Tensor], axis: usize) -> Result<Tensor>;
    fn reverse(&mut self, input: &Tensor, axes: &[usize]) -> Result<Tensor>;
}
Expand description

Indexing, slicing, and padding operations.

§Examples

use tenferro_tensor::TensorIndexing;

fn accepts_indexing<B: TensorIndexing>(_backend: &mut B) {}

Required Methods§

Source

fn gather( &mut self, operand: &Tensor, start_indices: &Tensor, config: &GatherConfig, ) -> Result<Tensor>

§Errors

Returns crate::Error::Validation with a typed ValidationError source for invalid shapes, ranks, axes, dtypes, or output metadata. It returns crate::Error::BackendFailure or crate::Error::BackendSource when backend execution or storage access cannot provide the requested result.

Source

fn scatter( &mut self, operand: &Tensor, scatter_indices: &Tensor, updates: &Tensor, config: &ScatterConfig, ) -> Result<Tensor>

§Errors

Returns crate::Error::Validation with a typed ValidationError source for invalid shapes, ranks, axes, dtypes, or output metadata. It returns crate::Error::BackendFailure or crate::Error::BackendSource when backend execution or storage access cannot provide the requested result.

Source

fn slice(&mut self, input: &Tensor, config: &SliceConfig) -> Result<Tensor>

§Errors

Returns crate::Error::Validation with a typed ValidationError source for invalid shapes, ranks, axes, dtypes, or output metadata. In particular, a limit greater than the corresponding input dimension is reported as crate::ValidationError::InvalidArgument with the "configuration" argument. It returns crate::Error::BackendFailure or crate::Error::BackendSource when backend execution or storage access cannot provide the requested result.

Source

fn dynamic_slice( &mut self, input: &Tensor, starts: &Tensor, slice_sizes: &[usize], ) -> Result<Tensor>

§Errors

Returns crate::Error::Validation with a typed ValidationError source for invalid shapes, ranks, axes, dtypes, or output metadata. It returns crate::Error::BackendFailure or crate::Error::BackendSource when backend execution or storage access cannot provide the requested result.

Source

fn dynamic_update_slice( &mut self, operand: &Tensor, update: &Tensor, starts: &Tensor, ) -> Result<Tensor>

§Errors

Returns crate::Error::Validation with a typed ValidationError source for invalid shapes, ranks, axes, dtypes, or output metadata. It returns crate::Error::BackendFailure or crate::Error::BackendSource when backend execution or storage access cannot provide the requested result.

Source

fn pad(&mut self, input: &Tensor, config: &PadConfig) -> Result<Tensor>

§Errors

Returns crate::Error::Validation with a typed ValidationError source for invalid shapes, ranks, axes, dtypes, or output metadata. It returns crate::Error::BackendFailure or crate::Error::BackendSource when backend execution or storage access cannot provide the requested result.

Source

fn concatenate(&mut self, inputs: &[&Tensor], axis: usize) -> Result<Tensor>

§Errors

Returns crate::Error::Validation with a typed ValidationError source for invalid shapes, ranks, axes, dtypes, or output metadata. It returns crate::Error::BackendFailure or crate::Error::BackendSource when backend execution or storage access cannot provide the requested result.

Source

fn reverse(&mut self, input: &Tensor, axes: &[usize]) -> Result<Tensor>

§Errors

Returns crate::Error::Validation with a typed ValidationError source for invalid shapes, ranks, axes, dtypes, or output metadata. It returns crate::Error::BackendFailure or crate::Error::BackendSource when backend execution or storage access cannot provide the requested result.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§