pub struct SplitAtOperation<'c> { /* private fields */ }
Expand description
A split_at
operation. Splits a shape at a given index.
Splits a shape at a given dimension index
, returning two shapes. If
index
is negative, it is treated as indexing from the back of the shape.
This negative-handling behavior is important when handling unranked shapes,
where the positive index is not necessarily knowable due to a dynamic
number of leading dimensions. If the result is in extent tensor form out of
bounds indices result in undefined behavior.
Examples:
- split_at([4,5,6], index=0) -> [], [4,5,6]
- split_at([4,5,6], index=1) -> [4], [5,6]
- split_at([4,5,6], index=2) -> [4,5], [6]
- split_at([4,5,6], index=3) -> [4,5,6], []
- split_at([4,5,6], index=4) -> error
- split_at([4,5,6], index=-1) -> [4,5], [6]
- split_at([4,5,6], index=-2) -> [4], [5,6]
- split_at([4,5,6], index=-3) -> [], [4,5,6]
- split_at([4,5,6], index=-4) -> error
Requires:
index
is in the range [-rank(operand),rank(operand)]
Implementations§
source§impl<'c> SplitAtOperation<'c>
impl<'c> SplitAtOperation<'c>
sourcepub fn as_operation(&self) -> &Operation<'c>
pub fn as_operation(&self) -> &Operation<'c>
Returns a generic operation.
sourcepub fn builder(
context: &'c Context,
location: Location<'c>
) -> SplitAtOperationBuilder<'c, Unset, Unset, Unset, Unset>
pub fn builder( context: &'c Context, location: Location<'c> ) -> SplitAtOperationBuilder<'c, Unset, Unset, Unset, Unset>
Creates a builder.
pub fn head(&self) -> Result<OperationResult<'c, '_>, Error>
pub fn tail(&self) -> Result<OperationResult<'c, '_>, Error>
pub fn operand(&self) -> Result<Value<'c, '_>, Error>
pub fn index(&self) -> Result<Value<'c, '_>, Error>
Trait Implementations§
source§impl<'c> From<SplitAtOperation<'c>> for Operation<'c>
impl<'c> From<SplitAtOperation<'c>> for Operation<'c>
source§fn from(operation: SplitAtOperation<'c>) -> Self
fn from(operation: SplitAtOperation<'c>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<'c> RefUnwindSafe for SplitAtOperation<'c>
impl<'c> !Send for SplitAtOperation<'c>
impl<'c> !Sync for SplitAtOperation<'c>
impl<'c> Unpin for SplitAtOperation<'c>
impl<'c> UnwindSafe for SplitAtOperation<'c>
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