MLIR
20.0.0git
|
Adaptor class to abstract the differences between whether value is from a ShapedType or ShapedTypeComponents or DenseIntElementsAttribute. More...
#include "mlir/Interfaces/InferTypeOpInterface.h"
Public Member Functions | |
ShapeAdaptor (Type t) | |
ShapeAdaptor (Attribute t) | |
ShapeAdaptor (ShapedTypeComponents *components) | |
ShapeAdaptor (ShapedTypeComponents &components) | |
bool | hasRank () const |
Returns whether the shape has a rank. More... | |
Type | getElementType () const |
Returns the element type. More... | |
void | getDims (SmallVectorImpl< int64_t > &res) const |
Populates the dimensions from shape referenced. More... | |
void | getDims (ShapedTypeComponents &res) const |
Populates the dimensions of the ShapeTypeComponents. More... | |
int64_t | getDimSize (int index) const |
Returns the size of the index'th dimension. More... | |
bool | isDynamicDim (int index) const |
Returns whether the index'th dimension is dynamic. More... | |
bool | hasStaticShape () const |
Returns whether the shape is fully static. More... | |
int64_t | getRank () const |
Returns the rank of the shape. More... | |
int64_t | getNumElements () const |
Returns the number of elements in the shape. More... | |
operator bool () const | |
Returns whether valid (non-null) shape. More... | |
void | dump () const |
Dumps textual repesentation to stderr. More... | |
Adaptor class to abstract the differences between whether value is from a ShapedType or ShapedTypeComponents or DenseIntElementsAttribute.
Definition at line 39 of file InferTypeOpInterface.h.
|
inline |
Definition at line 41 of file InferTypeOpInterface.h.
|
inline |
Definition at line 45 of file InferTypeOpInterface.h.
|
inline |
Definition at line 49 of file InferTypeOpInterface.h.
|
inline |
Definition at line 50 of file InferTypeOpInterface.h.
void ShapeAdaptor::dump | ( | ) | const |
Dumps textual repesentation to stderr.
Definition at line 174 of file InferTypeOpInterface.cpp.
void ShapeAdaptor::getDims | ( | ShapedTypeComponents & | res | ) | const |
Populates the dimensions of the ShapeTypeComponents.
Requires: shape is ranked.
Definition at line 105 of file InferTypeOpInterface.cpp.
void ShapeAdaptor::getDims | ( | SmallVectorImpl< int64_t > & | res | ) | const |
Populates the dimensions from shape referenced.
Requires: shape is ranked.
Definition at line 88 of file InferTypeOpInterface.cpp.
References hasRank().
Referenced by dump(), getDims(), getRank(), ReduceInferReturnTypes(), and mlir::ShapedTypeComponents::ShapedTypeComponents().
int64_t ShapeAdaptor::getDimSize | ( | int | index | ) | const |
Returns the size of the index'th dimension.
Requires: shape is ranked.
Definition at line 111 of file InferTypeOpInterface.cpp.
References mlir::ShapedTypeComponents::getDims(), and hasRank().
Referenced by isDynamicDim(), and poolingInferReturnTypes().
Type ShapeAdaptor::getElementType | ( | ) | const |
Returns the element type.
Definition at line 78 of file InferTypeOpInterface.cpp.
Referenced by mlir::ShapedTypeComponents::ShapedTypeComponents().
int64_t ShapeAdaptor::getNumElements | ( | ) | const |
Returns the number of elements in the shape.
Requires: hasStaticShape
Definition at line 149 of file InferTypeOpInterface.cpp.
References hasStaticShape().
int64_t ShapeAdaptor::getRank | ( | ) | const |
Returns the rank of the shape.
Requires: shape is ranked.
Definition at line 123 of file InferTypeOpInterface.cpp.
References getDims(), and hasRank().
Referenced by dump(), and ReduceInferReturnTypes().
bool ShapeAdaptor::hasRank | ( | ) | const |
Returns whether the shape has a rank.
Definition at line 68 of file InferTypeOpInterface.cpp.
Referenced by dump(), getDims(), getDimSize(), getRank(), hasStaticShape(), ReduceInferReturnTypes(), and mlir::ShapedTypeComponents::ShapedTypeComponents().
bool ShapeAdaptor::hasStaticShape | ( | ) | const |
Returns whether the shape is fully static.
Definition at line 132 of file InferTypeOpInterface.cpp.
References hasRank().
Referenced by getNumElements().
|
inline |
Returns whether the index'th dimension is dynamic.
Requires: shape is ranked.
Definition at line 72 of file InferTypeOpInterface.h.
References getDimSize().
|
inlineexplicit |
Returns whether valid (non-null) shape.
Definition at line 88 of file InferTypeOpInterface.h.