MLIR: mlir::TensorType Class Reference (original) (raw)

Tensor types represent multi-dimensional arrays, and have two variants: RankedTensorType and UnrankedTensorType. More...

#include "[mlir/IR/BuiltinTypes.h](mlir%5F2IR%5F2BuiltinTypes%5F8h%5Fsource.html)"

Public Member Functions
Type getElementType () const
Returns the element type of this tensor type. More...
bool hasRank () const
Returns if this type is ranked, i.e. it has a known number of dimensions. More...
ArrayRef< int64_t > getShape () const
Returns the shape of this tensor type. More...
TensorType cloneWith (std::optional< ArrayRef< int64_t >> shape, Type elementType) const
Clone this type with the given shape and element type. More...
RankedTensorType clone (ArrayRef< int64_t > shape, Type elementType) const
Return a clone of this type with the given new shape and element type. More...
RankedTensorType clone (ArrayRef< int64_t > shape) const
Return a clone of this type with the given new shape. More...
operator ShapedType () const
Allow implicit conversion to ShapedType. More...
constexpr Type ()=default
Type (const ImplType *impl)
Type (const Type &other)=default
- Public Member Functions inherited from mlir::Type
constexpr Type ()=default
Type (const ImplType *impl)
Type (const Type &other)=default
Type & operator= (const Type &other)=default
bool operator== (Type other) const
bool operator!= (Type other) const
operator bool () const
bool operator! () const
TypeID getTypeID ()
Return a unique identifier for the concrete type. More...
MLIRContext * getContext () const
Return the MLIRContext in which this type was uniqued. More...
Dialect & getDialect () const
Get the dialect this type is registered to. More...
bool isIndex () const
bool isBF16 () const
bool isF16 () const
bool isTF32 () const
bool isF32 () const
bool isF64 () const
bool isF80 () const
bool isF128 () const
bool isFloat () const
Return true if this is an float type (with the specified width). More...
bool isFloat (unsigned width) const
Return true if this is a float type with the specified width. More...
bool isInteger () const
Return true if this is an integer type (with the specified width). More...
bool isInteger (unsigned width) const
bool isSignlessInteger () const
Return true if this is a signless integer type (with the specified width). More...
bool isSignlessInteger (unsigned width) const
bool isSignedInteger () const
Return true if this is a signed integer type (with the specified width). More...
bool isSignedInteger (unsigned width) const
bool isUnsignedInteger () const
Return true if this is an unsigned integer type (with the specified width). More...
bool isUnsignedInteger (unsigned width) const
unsigned getIntOrFloatBitWidth () const
Return the bit width of an integer or a float type, assert failure on other types. More...
bool isSignlessIntOrIndex () const
Return true if this is a signless integer or index type. More...
bool isSignlessIntOrIndexOrFloat () const
Return true if this is a signless integer, index, or float type. More...
bool isSignlessIntOrFloat () const
Return true of this is a signless integer or a float type. More...
bool isIntOrIndex () const
Return true if this is an integer (of any signedness) or an index type. More...
bool isIntOrFloat () const
Return true if this is an integer (of any signedness) or a float type. More...
bool isIntOrIndexOrFloat () const
Return true if this is an integer (of any signedness), index, or float type. More...
void print (raw_ostream &os) const
Print the current type. More...
void print (raw_ostream &os, AsmState &state) const
void dump () const
const void * getAsOpaquePointer () const
Methods for supporting PointerLikeTypeTraits. More...
template
bool hasPromiseOrImplementsInterface ()
Returns true if InterfaceT has been promised by the dialect or implemented. More...
template<template< typename T > class Trait>
bool hasTrait ()
Returns true if the type was registered with a particular trait. More...
const AbstractTy & getAbstractType () const
Return the abstract type descriptor for this type. More...
ImplType * getImpl () const
Return the Type implementation. More...
void walkImmediateSubElements (function_ref< void(Attribute)> walkAttrsFn, function_ref< void(Type)> walkTypesFn) const
Walk all of the immediately nested sub-attributes and sub-types. More...
auto replaceImmediateSubElements (ArrayRef< Attribute > replAttrs, ArrayRef< Type > replTypes) const
Replace the immediately nested sub-attributes and sub-types with those provided. More...
template
auto walk (WalkFns &&...walkFns)
Walk this type and all attibutes/types nested within using the provided walk functions. More...
template<typename... ReplacementFns>
auto replace (ReplacementFns &&...replacementFns)
Recursively replace all of the nested sub-attributes and sub-types using the provided map functions. More...
Static Public Member Functions
static bool isValidElementType (Type type)
Return true if the specified element type is ok in a tensor. More...
static bool classof (Type type)
Methods for support type inquiry through isa, cast, and dyn_cast. More...
- Static Public Member Functions inherited from mlir::Type
static Type getFromOpaquePointer (const void *pointer)
Additional Inherited Members
- Public Types inherited from mlir::Type
template<typename ConcreteType , typename BaseType , typename StorageType , template< typename T > class... Traits>
using TypeBase = detail::StorageUserBase< ConcreteType, BaseType, StorageType, detail::TypeUniquer, Traits... >
Utility class for implementing types. More...
using ImplType = TypeStorage
using AbstractTy = AbstractType
- Protected Attributes inherited from mlir::Type
ImplType * impl {nullptr}

Tensor types represent multi-dimensional arrays, and have two variants: RankedTensorType and UnrankedTensorType.

Note: This class attaches the ShapedType trait to act as a mixin to provide many useful utility functions. This inheritance has no effect on derived tensor types.

Definition at line 55 of file BuiltinTypes.h.

classof()

bool mlir::TensorType::classof ( Type type) inlinestatic

Methods for support type inquiry through isa, cast, and dyn_cast.

Definition at line 404 of file BuiltinTypes.h.

clone() [1/2]

RankedTensorType mlir::TensorType::clone ( ArrayRef< int64_t > shape ) const

Return a clone of this type with the given new shape.

The returned type is ranked, even if this type is unranked.

clone() [2/2]

RankedTensorType mlir::TensorType::clone ( ArrayRef< int64_t > shape,
Type elementType
) const

Return a clone of this type with the given new shape and element type.

The returned type is ranked, even if this type is unranked.

cloneWith()

Clone this type with the given shape and element type.

If the provided shape is std::nullopt, the current shape of the type is used.

Definition at line 273 of file BuiltinTypes.cpp.

References mlir::get().

getElementType()

Type TensorType::getElementType ( ) const

getShape()

ArrayRef< int64_t > TensorType::getShape ( ) const

hasRank()

bool TensorType::hasRank ( ) const

isValidElementType()

bool TensorType::isValidElementType ( Type type) static

operator ShapedType()

mlir::TensorType::operator ShapedType ( ) const inline

Allow implicit conversion to ShapedType.

Definition at line 91 of file BuiltinTypes.h.

Type() [1/3]

constexpr mlir::Type::Type constexprdefault

Type() [2/3]

Type() [3/3]


The documentation for this class was generated from the following files: