tvm
|
Map container of NodeRef->NodeRef in DSL graph. Map implements copy on write semantics, which means map is mutable but copy will happen when array is referenced in more than two places. More...
#include <map.h>
Classes | |
class | iterator |
Iterator of the hash map. More... | |
Public Types | |
using | key_type = K |
using | mapped_type = V |
using | ContainerType = MapNode |
specify container node More... | |
![]() | |
using | ContainerType = Object |
type indicate the container type. More... | |
Public Member Functions | |
Map () | |
default constructor More... | |
Map (Map< K, V > &&other) | |
move constructor More... | |
Map (const Map< K, V > &other) | |
copy constructor More... | |
Map< K, V > & | operator= (Map< K, V > &&other) |
copy assign operator More... | |
Map< K, V > & | operator= (const Map< K, V > &other) |
move assign operator More... | |
Map (ObjectPtr< Object > n) | |
constructor from pointer More... | |
template<typename IterType > | |
Map (IterType begin, IterType end) | |
constructor from iterator More... | |
Map (std::initializer_list< std::pair< K, V >> init) | |
constructor from initializer list More... | |
template<typename Hash , typename Equal > | |
Map (const std::unordered_map< K, V, Hash, Equal > &init) | |
constructor from unordered_map More... | |
const V | at (const K &key) const |
Read element from map. More... | |
const V | operator[] (const K &key) const |
Read element from map. More... | |
size_t | size () const |
size_t | count (const K &key) const |
bool | empty () const |
void | clear () |
Release reference to all the elements. More... | |
void | Set (const K &key, const V &value) |
set the Map. More... | |
iterator | begin () const |
iterator | end () const |
iterator | find (const K &key) const |
Optional< V > | Get (const K &key) const |
void | erase (const K &key) |
MapNode * | CopyOnWrite () |
copy on write semantics Do nothing if current handle is the unique copy of the array. Otherwise make a new copy of the array to ensure the current handle hold a unique copy. More... | |
![]() | |
ObjectRef ()=default | |
default constructor More... | |
ObjectRef (ObjectPtr< Object > data) | |
Constructor from existing object ptr. More... | |
bool | same_as (const ObjectRef &other) const |
Comparator. More... | |
bool | operator== (const ObjectRef &other) const |
Comparator. More... | |
bool | operator!= (const ObjectRef &other) const |
Comparator. More... | |
bool | operator< (const ObjectRef &other) const |
Comparator. More... | |
bool | defined () const |
const Object * | get () const |
const Object * | operator-> () const |
bool | unique () const |
int | use_count () const |
template<typename ObjectType , typename = std::enable_if_t<std::is_base_of_v<Object, ObjectType>>> | |
const ObjectType * | as () const |
Try to downcast the internal Object to a raw pointer of a corresponding type. More... | |
template<typename ObjectRefType , typename = std::enable_if_t<std::is_base_of_v<ObjectRef, ObjectRefType>>> | |
Optional< ObjectRefType > | as () const |
Try to downcast the ObjectRef to a Optional<T> of the requested type. More... | |
Additional Inherited Members | |
![]() | |
static constexpr bool | _type_is_nullable = true |
![]() | |
Object * | get_mutable () const |
![]() | |
template<typename T > | |
static T | DowncastNoCheck (ObjectRef ref) |
Internal helper function downcast a ref without check. More... | |
static void | FFIClearAfterMove (ObjectRef *ref) |
Clear the object ref data field without DecRef after we successfully moved the field. More... | |
template<typename ObjectType > | |
static ObjectPtr< ObjectType > | GetDataPtr (const ObjectRef &ref) |
Internal helper function get data_ as ObjectPtr of ObjectType. More... | |
![]() | |
ObjectPtr< Object > | data_ |
Internal pointer that backs the reference. More... | |
Map container of NodeRef->NodeRef in DSL graph. Map implements copy on write semantics, which means map is mutable but copy will happen when array is referenced in more than two places.
operator[] only provide const acces, use Set to mutate the content.
K | The key NodeRef type. |
V | The value NodeRef type. |
using tvm::runtime::Map< K, V, typename, typename >::ContainerType = MapNode |
specify container node
using tvm::runtime::Map< K, V, typename, typename >::key_type = K |
using tvm::runtime::Map< K, V, typename, typename >::mapped_type = V |
|
inline |
default constructor
|
inline |
move constructor
other | source |
|
inline |
copy constructor
other | source |
|
inlineexplicit |
constructor from pointer
n | the container pointer |
|
inline |
constructor from iterator
begin | begin of iterator |
end | end of iterator |
IterType | The type of iterator |
|
inline |
constructor from initializer list
init | The initalizer list |
|
inline |
constructor from unordered_map
init | The unordered_map |
|
inline |
Read element from map.
key | The key |
|
inline |
|
inline |
Release reference to all the elements.
|
inline |
copy on write semantics Do nothing if current handle is the unique copy of the array. Otherwise make a new copy of the array to ensure the current handle hold a unique copy.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
move assign operator
other | The source of assignment |
|
inline |
copy assign operator
other | The source of assignment |
|
inline |
Read element from map.
key | The key |
|
inline |
set the Map.
key | The index key. |
value | The value to be setted. |
|
inline |