|
ONE - On-device Neural Engine
|
Create a value from constant byte array. More...
#include <Nodes.h>

Public Member Functions | |
| ConstGen ()=default | |
| template<DataType DT> | |
| uint32_t | size (void) const |
| Return the number of reserved elements. | |
| template<DataType DT> | |
| void | size (uint32_t size) |
| Adjust the number of reserved elements. | |
| template<DataType DT> | |
| const DataTypeImpl< DT >::Type & | at (uint32_t n) const |
| Get the element at a given position @require at(n) is valid only when n < size() | |
| template<DataType DT> | |
| DataTypeImpl< DT >::Type & | at (uint32_t n) |
| Update the element at a given position @require at(n) is valid only when n < size() | |
Public Member Functions inherited from loco::CanonicalNodeDef< CanonicalOpcode::ConstGen, FixedArity< 0 >::Mixin, With< NodeTrait::DataType >::Mixin, With< NodeTrait::TensorShape >::Mixin > | |
| virtual | ~CanonicalNodeDef ()=default |
| uint32_t | opnum (void) const final |
| CanonicalOpcode | opcode (void) const final |
Public Member Functions inherited from loco::CanonicalNode | |
| virtual | ~CanonicalNode ()=default |
| const Dialect * | dialect (void) const final |
| Return "Dialect" identifier that this node belongs to. | |
| template<typename T > | |
| T | accept (CanonicalNodeVisitorBase< T > *) const |
| template<typename T > | |
| T | accept (CanonicalNodeMutableVisitorBase< T > *) |
Public Member Functions inherited from loco::Node | |
| Node ()=default | |
| Node (const Node &)=delete | |
| Node (Node &&)=delete | |
| virtual | ~Node () |
| Graph * | graph (void) |
| const Graph * | graph (void) const |
| virtual uint32_t | arity (void) const =0 |
| Return the number of arguments. | |
| virtual Node * | arg (uint32_t N) const =0 |
| Access N-th argument node. | |
| virtual void | drop (void)=0 |
| Drop all the reference of arguments. | |
Public Member Functions inherited from loco::AnnotatedItem< NodeAnnotation > | |
| AnnotatedItem ()=default | |
| virtual | ~AnnotatedItem ()=default |
| const T * | annot (void) const |
| Retrieve a stored annotation of type T. | |
| void | annot (std::unique_ptr< T > &&p) |
| Attach or remove a new annotation of type T. | |
Create a value from constant byte array.
Let us assume that a 'ConstGen' generates a constant tensor of shape "S". for each valid index I, the corresponding value comes from offset(S, I) where the implementation of "offset" is given as follows:
uint32_t stride(TensorShape shape, uint32_t axis) { uint32_t res = 1; for (uint32_t n = rank(shape) - 1; n > axis; –n) { res *= shape.dim(n); } return res; }
uint32_t offset(TensorShape shape, TensorIndex index) { uint32_t res = 0; for (uint32_t n = 0; n < rank(shape); ++n) { res += index.at(n) * stride(shape, n); } return res; }
|
default |
| DataTypeImpl< DT >::Type & loco::ConstGen::at | ( | uint32_t | n | ) |
Update the element at a given position @require at(n) is valid only when n < size()
Definition at line 205 of file Nodes.cpp.
References loco::must_cast().
| const DataTypeImpl< DT >::Type & loco::ConstGen::at | ( | uint32_t | n | ) | const |
Get the element at a given position @require at(n) is valid only when n < size()
Definition at line 198 of file Nodes.cpp.
References loco::must_cast().
Referenced by moco::onnx::Constant_V1::build(), moco::onnx::Constant_V9::build(), and exo::ConstGenConverter::convert().
Adjust the number of reserved elements.
Definition at line 192 of file Nodes.cpp.
References loco::must_cast().
Return the number of reserved elements.
Definition at line 185 of file Nodes.cpp.
References loco::must_cast().
Referenced by exo::ConstGenConverter::convert().