|
mxnet
|
Array container of NodeRef in DSL graph. Array implements copy on write semantics, which means array is mutable but copy will happen when array is referenced in more than two places. More...
#include <container.h>


Classes | |
| struct | ValueConverter |
Public Types | |
| using | ContainerType = ArrayNode |
| specify container node More... | |
| using | iterator = IterAdapter< ValueConverter, std::vector< ObjectRef >::const_iterator > |
| using | reverse_iterator = IterAdapter< ValueConverter, std::vector< ObjectRef >::const_reverse_iterator > |
Public Types inherited from mxnet::runtime::ObjectRef | |
| using | ContainerType = Object |
| type indicate the container type. More... | |
Public Member Functions | |
| Array () | |
| default constructor More... | |
| Array (Array< T > &&other) | |
| move constructor More... | |
| Array (const Array< T > &other) | |
| copy constructor More... | |
| Array (runtime::ObjectPtr< Object > n) | |
| constructor from pointer More... | |
| template<typename IterType > | |
| Array (IterType begin, IterType end) | |
| constructor from iterator More... | |
| Array (std::initializer_list< T > init) | |
| constructor from initializer list More... | |
| Array (const std::vector< T > &init) | |
| constructor from vector More... | |
| Array (size_t n, const T &val) | |
| Constructs a container with n elements. Each element is a copy of val. More... | |
| Array< T > & | operator= (Array< T > &&other) |
| move assign operator More... | |
| Array< T > & | operator= (const Array< T > &other) |
| copy assign operator More... | |
| template<typename IterType > | |
| void | assign (IterType begin, IterType end) |
| reset the array to content from iterator. More... | |
| const T | operator[] (size_t i) const |
| Read i-th element from array. More... | |
| size_t | size () const |
| ArrayNode * | 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... | |
| void | push_back (const T &item) |
| push a new item to the back of the list More... | |
| void | resize (size_t size) |
| Resize the array. More... | |
| void | Set (size_t i, const T &value) |
| set i-th element of the array. More... | |
| bool | empty () const |
| template<typename F > | |
| void | MutateByApply (F fmutate) |
| Helper function to apply fmutate to mutate an array. More... | |
| iterator | begin () const |
| iterator | end () const |
| reverse_iterator | rbegin () const |
| reverse_iterator | rend () const |
Public Member Functions inherited from mxnet::runtime::ObjectRef | |
| 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 |
| template<typename ObjectType > | |
| const ObjectType * | as () const |
| Try to downcast the internal Object to a raw pointer of a corresponding type. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from mxnet::runtime::ObjectRef | |
| Object * | get_mutable () const |
Static Protected Member Functions inherited from mxnet::runtime::ObjectRef | |
| template<typename T > | |
| static T | DowncastNoCheck (ObjectRef ref) |
| Internal helper function downcast a ref without check. More... | |
| template<typename ObjectType > | |
| static ObjectPtr< ObjectType > | GetDataPtr (const ObjectRef &ref) |
| Internal helper function get data_ as ObjectPtr of ObjectType. More... | |
Protected Attributes inherited from mxnet::runtime::ObjectRef | |
| ObjectPtr< Object > | data_ |
| Internal pointer that backs the reference. More... | |
Array container of NodeRef in DSL graph. Array implements copy on write semantics, which means array 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.
| T | The content NodeRef type. |
| using mxnet::Array< T, typename >::ContainerType = ArrayNode |
specify container node
| using mxnet::Array< T, typename >::iterator = IterAdapter<ValueConverter, std::vector<ObjectRef>::const_iterator> |
| using mxnet::Array< T, typename >::reverse_iterator = IterAdapter< ValueConverter, std::vector<ObjectRef>::const_reverse_iterator> |
|
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 vector
| init | The vector |
|
inlineexplicit |
Constructs a container with n elements. Each element is a copy of val.
| n | The size of the container |
| val | The init value |
|
inline |
reset the array to content from iterator.
| begin | begin of iterator |
| end | end of iterator |
| IterType | The type of iterator |
|
inline |
|
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 |
Helper function to apply fmutate to mutate an array.
| fmutate | The transformation function T -> T. |
| F | the type of the mutation function. |
|
inline |
move assign operator
| other | The source of assignment |
|
inline |
copy assign operator
| other | The source of assignment |
|
inline |
Read i-th element from array.
| i | The index |
|
inline |
push a new item to the back of the list
| item | The item to be pushed. |
|
inline |
|
inline |
|
inline |
Resize the array.
| size | The new size. |
|
inline |
set i-th element of the array.
| i | The index |
| value | The value to be setted. |
|
inline |
1.8.13