pub struct DimOperation<'c> { /* private fields */ }
Expand description
A dim
operation. Dimension index operation.
The dim
operation takes a memref and a dimension operand of type index
.
It returns the size of the requested dimension of the given memref.
If the dimension index is out of bounds the behavior is undefined.
The specified memref type is that of the first operand.
Example:
// Always returns 4, can be constant folded:
%c0 = arith.constant 0 : index
%x = memref.dim %A, %c0 : memref<4 x ? x f32>
// Returns the dynamic dimension of %A.
%c1 = arith.constant 1 : index
%y = memref.dim %A, %c1 : memref<4 x ? x f32>
// Equivalent generic form:
%x = "memref.dim"(%A, %c0) : (memref<4 x ? x f32>, index) -> index
%y = "memref.dim"(%A, %c1) : (memref<4 x ? x f32>, index) -> index
Implementations§
source§impl<'c> DimOperation<'c>
impl<'c> DimOperation<'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>
) -> DimOperationBuilder<'c, Unset, Unset, Unset>
pub fn builder( context: &'c Context, location: Location<'c> ) -> DimOperationBuilder<'c, Unset, Unset, Unset>
Creates a builder.
pub fn result(&self) -> Result<OperationResult<'c, '_>, Error>
pub fn source(&self) -> Result<Value<'c, '_>, Error>
pub fn index(&self) -> Result<Value<'c, '_>, Error>
Trait Implementations§
source§impl<'c> From<DimOperation<'c>> for Operation<'c>
impl<'c> From<DimOperation<'c>> for Operation<'c>
source§fn from(operation: DimOperation<'c>) -> Self
fn from(operation: DimOperation<'c>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<'c> RefUnwindSafe for DimOperation<'c>
impl<'c> !Send for DimOperation<'c>
impl<'c> !Sync for DimOperation<'c>
impl<'c> Unpin for DimOperation<'c>
impl<'c> UnwindSafe for DimOperation<'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