MLIR
19.0.0git

Functions  
bool  getBroadcastedShape (ArrayRef< int64_t > shape1, ArrayRef< int64_t > shape2, SmallVectorImpl< int64_t > &resultShape) 
Returns true and sets resultShape to the broadcasted shape from the two given shapes if they are broadcast compatible. More...  
bool  staticallyKnownBroadcastable (ArrayRef< SmallVector< int64_t, 6 >> shapes) 
Returns true if a broadcast between n shapes is guaranteed to be successful and not result in an error. More...  
bool  staticallyKnownBroadcastable (ArrayRef< int64_t > shape1, ArrayRef< int64_t > shape2) 
Type  getBroadcastedType (Type type1, Type type2, Type elementType=nullptr) 
Returns the result broadcast composition type from the two given types by following NumPy broadcast semantics. More...  
bool mlir::OpTrait::util::getBroadcastedShape  (  ArrayRef< int64_t >  shape1, 
ArrayRef< int64_t >  shape2,  
SmallVectorImpl< int64_t > &  resultShape  
) 
Returns true and sets resultShape
to the broadcasted shape from the two given shapes if they are broadcast compatible.
Returns false and clears resultShape
otherwise.
The rules for determining the result shape are:
Zip together the dimensions in the two given shapes by prepending the shape with less dimensions with 1s. For each dimension pair, deduces the result dimension according to the following order:
Definition at line 60 of file Traits.cpp.
References copy().
Referenced by getBroadcastedType().
Returns the result broadcast composition type from the two given types by following NumPy broadcast semantics.
Returned type may have dynamic shape if either of the input types has dynamic shape. Returns null type if the two given types are not broadcastcompatible.
elementType, if specified, will be used as the element type of the broadcasted result type. Otherwise it is required that the element type of type1 and type2 is the same and this element type will be used as the resultant element type.
Definition at line 133 of file Traits.cpp.
References mlir::get(), getBroadcastedShape(), mlir::getElementTypeOrSelf(), and getShape().
bool mlir::OpTrait::util::staticallyKnownBroadcastable  (  ArrayRef< int64_t >  shape1, 
ArrayRef< int64_t >  shape2  
) 
Definition at line 17 of file Traits.cpp.
References staticallyKnownBroadcastable().
bool mlir::OpTrait::util::staticallyKnownBroadcastable  (  ArrayRef< SmallVector< int64_t, 6 >>  shapes  ) 
Returns true if a broadcast between n shapes is guaranteed to be successful and not result in an error.
False does not guarantee that the shapes are not broadcastable; it might guarantee that they are not broadcastable or it might mean that this function does not have enough information to know.
Conceptually, this returns true if getBroadcastedShape would have returned true and vice versa, with one exception. If a dimension is unknown in both shapes, getBroadcastedShape would return true and have a result with unknown dimension, while this function will return false because it's possible for both shapes to have a dimension greater than 1 and different which would fail to broadcast.
Definition at line 25 of file Traits.cpp.
References max().
Referenced by staticallyKnownBroadcastable().