pub struct DimOperation<'c> { /* private fields */ }
Expand description
A dim
operation. Dimension index operation.
The tensor.dim
operation takes a tensor and a dimension operand of type
index
. It returns the size of the requested dimension of the given
tensor. If the dimension index is out of bounds, the behavior is undefined.
The specified tensor type is that of the first operand.
Example:
// Always returns 4, can be constant folded:
%c0 = arith.constant 0 : index
%x = tensor.dim %A, %c0 : tensor<4x?xf32>
// Return the dynamic dimension of %A.
%c1 = arith.constant 1 : index
%y = tensor.dim %A, %c1 : memref<4x?xf32>
// Equivalent generic form:
%x = "tensor.dim"(%A, %c0) : (memref<4x?xf32>, index) -> index
%y = "tensor.dim"(%A, %c1) : (memref<4x?xf32>, 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