My Project
|
#include <Attributes.h>
Public Types | |
template<typename T > | |
using | iterator = llvm::mapped_iterator< llvm::detail::value_sequence_iterator< ptrdiff_t >, std::function< T(ptrdiff_t)> > |
![]() | |
using | Base = StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT > |
Utility declarations for the concrete attribute class. More... | |
using | ImplType = StorageT |
Public Member Functions | |
DenseIntElementsAttr | getIndices () const |
DenseElementsAttr | getValues () const |
template<typename T > | |
llvm::iterator_range< iterator< T > > | getValues () const |
Attribute | getValue (ArrayRef< uint64_t > index) const |
Return the value of the element at the given index. More... | |
Static Public Member Functions | |
static SparseElementsAttr | get (ShapedType type, DenseElementsAttr indices, DenseElementsAttr values) |
'type' must be a vector or tensor with static shape. More... | |
static bool | kindof (unsigned kind) |
Method for support type inquiry through isa, cast and dyn_cast. More... | |
![]() | |
static ClassID * | getClassID () |
Return a unique identifier for the concrete type. More... | |
template<typename T > | |
static bool | classof (T val) |
Additional Inherited Members | |
![]() | |
ImplType * | getImpl () const |
Utility for easy access to the storage instance. More... | |
![]() | |
template<typename... Args> | |
static ConcreteT | get (MLIRContext *ctx, unsigned kind, Args... args) |
template<typename... Args> | |
static ConcreteT | getChecked (const Location &loc, MLIRContext *ctx, unsigned kind, Args... args) |
template<typename... Args> | |
static LogicalResult | verifyConstructionInvariants (Args... args) |
Default implementation that just returns success. More... | |
An attribute that represents a reference to a sparse vector or tensor object.
This class uses COO (coordinate list) encoding to represent the sparse elements in an element attribute. Specifically, the sparse vector/tensor stores the indices and values as two separate dense elements attributes of tensor type (even if the sparse attribute is of vector type, in order to support empty lists). The dense elements attribute indices is a 2-D tensor of 64-bit integer elements with shape [N, ndims], which specifies the indices of the elements in the sparse tensor that contains nonzero values. The dense elements attribute values is a 1-D tensor with shape [N], and it supplies the corresponding values for the indices.
For example, sparse<tensor<3x4xi32>, [[0, 0], [1, 2]], [1, 5]>
represents tensor [[1, 0, 0, 0], [0, 0, 5, 0], [0, 0, 0, 0]].
using mlir::SparseElementsAttr::iterator = llvm::mapped_iterator<llvm::detail::value_sequence_iterator<ptrdiff_t>, std::function<T(ptrdiff_t)> > |
|
static |
'type' must be a vector or tensor with static shape.
DenseIntElementsAttr SparseElementsAttr::getIndices | ( | ) | const |
Return the value of the element at the given index.
Return the value of the element at the given index. The 'index' is expected to refer to a valid element.
DenseElementsAttr SparseElementsAttr::getValues | ( | ) | const |
|
inline |
Return the values of this attribute in the form of the given type 'T'. 'T' may be any of Attribute, APInt, APFloat, c++ integer/float types, etc.
|
inlinestatic |
Method for support type inquiry through isa, cast and dyn_cast.