pub struct CollapseShapeOperation<'c> { /* private fields */ }
Expand description
A collapse_shape
operation. Operation to produce a tensor with a smaller rank.
The tensor.collapse_shape
op produces a new tensor with a smaller
rank whose sizes are a reassociation of the original src
.
A reassociation is defined as a continuous grouping of dimensions and is represented with an array of DenseI64ArrayAttr attribute.
The verification rule is that the reassociation maps are applied to the operand tensor with the higher rank to obtain the result tensor with the smaller rank.
The result tensor type of a reshape can be zero-ranked if the operand tensor type is statically shaped with all dimensions being unit extent. In such case the reassociation map is empty.
Examples:
// Dimension collapse (i, j) -> i' and k -> k'
%b = tensor.collapse_shape %a [[0, 1], [2]]
: tensor<?x?x?xf32> into tensor<?x?xf32>
Implementations§
source§impl<'c> CollapseShapeOperation<'c>
impl<'c> CollapseShapeOperation<'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>
) -> CollapseShapeOperationBuilder<'c, Unset, Unset, Unset>
pub fn builder( context: &'c Context, location: Location<'c> ) -> CollapseShapeOperationBuilder<'c, Unset, Unset, Unset>
Creates a builder.
pub fn result(&self) -> Result<OperationResult<'c, '_>, Error>
pub fn src(&self) -> Result<Value<'c, '_>, Error>
pub fn reassociation(&self) -> Result<ArrayAttribute<'c>, Error>
pub fn set_reassociation(&mut self, value: ArrayAttribute<'c>)
Trait Implementations§
source§impl<'c> From<CollapseShapeOperation<'c>> for Operation<'c>
impl<'c> From<CollapseShapeOperation<'c>> for Operation<'c>
source§fn from(operation: CollapseShapeOperation<'c>) -> Self
fn from(operation: CollapseShapeOperation<'c>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<'c> RefUnwindSafe for CollapseShapeOperation<'c>
impl<'c> !Send for CollapseShapeOperation<'c>
impl<'c> !Sync for CollapseShapeOperation<'c>
impl<'c> Unpin for CollapseShapeOperation<'c>
impl<'c> UnwindSafe for CollapseShapeOperation<'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