pub struct WithOperation<'c> { /* private fields */ }
Expand description
A with_shape
operation. Returns ValueShape with given shape.
Returns ValueShape with the shape updated to match the shape operand. That
is a new ValueShape tuple is created with value equal to operand
’s
value and shape equal to shape
. If the ValueShape and given shape
are
non-conformant, then the returned ValueShape will represent an error of
this mismatch. Similarly if either inputs are in an error state, then an
error is propagated.
Usage: %0 = shape.with_shape %1, %2 : tensor<…>, !shape.shape
This is used, for example, where one combines shape function calculations and/or call one shape function from another. E.g.,
func.func @shape_foobah(%a: !shape.value_shape,
%b: !shape.value_shape,
%c: !shape.value_shape) -> !shape.shape {
%0 = call @shape_foo(%a, %b) :
(!shape.value_shape, !shape.value_shape) -> !shape.shape
%1 = shape.with_shape %b, %0 : !shape.value_shape, !shape.shape
%2 = call @shape_bah(%c, %1) :
(!shape.value_shape, !shape.value_shape) -> !shape.shape
return %2 : !shape.shape
}
This op need not be a refinement of the shape. In non-error cases the input
ValueShape’s value and shape are conformant and so too for the output, but
the result may be less specified than operand
’s shape as shape
is
merely used to construct the new ValueShape. If join behavior is desired
then a join op should be used.
Implementations§
source§impl<'c> WithOperation<'c>
impl<'c> WithOperation<'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>
) -> WithOperationBuilder<'c, Unset, Unset, Unset>
pub fn builder( context: &'c Context, location: Location<'c> ) -> WithOperationBuilder<'c, Unset, Unset, Unset>
Creates a builder.