23#ifndef TVM_IR_ATTR_REGISTRY_MAP_H_
24#define TVM_IR_ATTR_REGISTRY_MAP_H_
26#include <tvm/ffi/string.h>
37template <
typename KeyType>
48 return idx < data_.size() ? (data_[
idx].second != 0) : 0;
62 <<
"Attribute " << attr_name_ <<
" has not been registered for " << key->name;
63 return data_[
idx].first;
72 template <
typename ValueType>
76 if (
idx < data_.size() && data_[
idx].second != 0) {
77 if constexpr (std::is_same_v<ValueType, ffi::Any>) {
78 return data_[
idx].first;
89 ffi::String attr_name_;
91 std::vector<std::pair<ffi::Any, int>> data_;
94 template <
typename,
typename>
104template <
typename KeyType,
typename ValueType>
124 if constexpr (std::is_same_v<ValueType, ffi::Any>) {
Generic attribute map.
Definition attr_registry_map.h:38
int count(const KeyType &key) const
Check if the map has key.
Definition attr_registry_map.h:45
const ffi::Any & operator[](const KeyType &key) const
get the corresponding value element at key.
Definition attr_registry_map.h:58
ValueType get(const KeyType &key, ValueType def_value) const
get the corresponding value element at key with default value.
Definition attr_registry_map.h:73
ffi::Map<Key, ValueType> used to store meta-data.
Definition attr_registry_map.h:105
const AttrRegistryMapContainerMap< KeyType > & map_
The internal map field.
Definition attr_registry_map.h:140
ValueType get(const KeyType &key, ValueType def_value) const
get the corresponding value element at key with default value.
Definition attr_registry_map.h:136
int count(const KeyType &key) const
Check if the map has op as key.
Definition attr_registry_map.h:117
ValueType operator[](const KeyType &key) const
get the corresponding value element at key.
Definition attr_registry_map.h:123
AttrRegistryMap(const AttrRegistryMapContainerMap< KeyType > &map)
constructor
Definition attr_registry_map.h:111
Definition instruction.h:31
Helper structure to register operators.
Definition op.h:207
RAII wrapper function to enter and exit a context object similar to python's with syntax.
Definition with_context.h:59
ContextType * get()
Definition with_context.h:81
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analyzer.h:40