Skip to main content

TypedTensorViewMutPair

Type Alias TypedTensorViewMutPair 

Source
pub type TypedTensorViewMutPair<'a, T, R = DynRank> = (TypedTensorViewMut<'a, T, R>, TypedTensorViewMut<'a, T, R>);
Expand description

Pair of mutable tensor views returned by disjoint multi-slice operations.

ยงExamples

use tenferro_tensor::{StridedSliceSpec, TypedTensorViewMut, TypedTensorViewMutPair};

let mut data = [1_i32, 2, 3, 4];
let mut view = TypedTensorViewMut::from_slice(vec![4], vec![1], 0, &mut data)?;
let pair: TypedTensorViewMutPair<'_, i32> = view
    .try_multi_slice_mut(
        &[StridedSliceSpec::new(0, Some(2), 1)],
        &[StridedSliceSpec::new(2, Some(4), 1)],
    )
    ?
    .unwrap();
assert_eq!(pair.0.shape(), &[2]);
assert_eq!(pair.1.shape(), &[2]);