ONE - On-device Neural Engine
Loading...
Searching...
No Matches
locoex Namespace Reference

Data Structures

struct  AttrTypeTrait
 
struct  AttrTypeTrait< COpAttrType::Float >
 
struct  AttrTypeTrait< COpAttrType::Int >
 
class  CircleDialect
 
class  CircleInstanceNorm
 INSTANCE_NORM in circle. More...
 
struct  CircleNode
 
struct  CircleNodeImpl
 
class  CircleNodeMixin
 
class  CircleNodeMixin< CircleNodeTrait::FusedActFunc >
 
struct  CircleNodeMutableVisitor
 
struct  CircleNodeMutableVisitorBase
 
struct  CircleNodeVisitor
 
struct  CircleNodeVisitorBase
 
struct  CircleShapeInferenceRule
 
struct  CircleTypeInferenceRule
 Type Inference Rule for CircleDialect. More...
 
struct  COpAttrData
 Struct that holds attr type. More...
 
struct  COpAttrFloat
 Struct that holds attr data of float type. More...
 
struct  COpAttrInt
 Struct that holds attr data of int type. More...
 
class  COpCall
 Class to calls custom operation. More...
 
class  COpDialect
 A singleton for locoex custom op Dialect. More...
 
struct  COpNode
 
class  COpNodeSummaryBuilder
 
struct  COpShapeInferenceRule
 Shape inference rule for COpDialect. More...
 
struct  COpTypeInferenceRule
 Type Inference Rule for COpDialect. More...
 
class  Filter
 
class  FixedArityNode
 Nodes with the fixed number of inputs. More...
 
class  Stride
 
class  TFLAdd
 ADD in TensorFlow Lite. More...
 
class  TFLAveragePool2D
 AVERAGE_POOL_2D in TensorFlow Lite. More...
 
class  TFLConcatenation
 CONCATENATION in TensorFlow Lite. More...
 
class  TFLConst
 Class to build tensor data. More...
 
class  TFLConv2D
 CONV_2D in TensorFlow Lite. More...
 
class  TFLDepthwiseConv2D
 DEPTHWISE_CONV_2D in TensorFlow Lite. More...
 
class  TFLDialect
 
class  TFLDiv
 DIV in TensorFlow Lite. More...
 
class  TFLFullyConnected
 FULLY_CONNECTED in TensorFlow Lite. More...
 
class  TFLMaximum
 MAXIMUM in TensorFlow Lite. More...
 
class  TFLMaxPool2D
 MAX_POOL_2D in TensorFlow Lite. More...
 
class  TFLMean
 
class  TFLMul
 MUL in TensorFlow Lite. More...
 
struct  TFLNode
 
struct  TFLNodeImpl
 
class  TFLNodeMixin
 
class  TFLNodeMixin< TFLNodeTrait::Bias >
 Mixin class for nodes that has a bias input. More...
 
class  TFLNodeMixin< TFLNodeTrait::FusedActFunc >
 
struct  TFLNodeMutableVisitor
 
struct  TFLNodeMutableVisitorBase
 
struct  TFLNodeVisitor
 
struct  TFLNodeVisitorBase
 
class  TFLRelu
 
class  TFLRelu6
 
class  TFLReshape
 
class  TFLRsqrt
 
struct  TFLShapeInferenceRule
 
class  TFLSqrt
 
class  TFLSquaredDifference
 
class  TFLSub
 SUB in TensorFlow Lite. More...
 
class  TFLTranspose
 TRANSPOSE in TensorFlow Lite. More...
 
class  TFLTransposeConv
 TRANSPOSE_CONV in TensorFlow Lite. More...
 
struct  TFLTypeInferenceRule
 Type Inference Rule for TFLDialect. More...
 
class  VariadicArityNode
 Nodes with the variadic inputs. More...
 

Enumerations

enum class  CircleNodeTrait { FusedActFunc }
 enumeration of mixin class More...
 
enum class  CircleOpcode { CIRCLE_NODE }
 
enum class  FusedActFunc { UNDEFINED , NONE , RELU , RELU6 }
 
enum class  Padding { UNDEFINED , SAME , VALID }
 
enum class  TFLNodeTrait { FusedActFunc , Bias }
 enumeration of mixin class More...
 
enum class  TFLOpcode { TFL_NODE }
 
enum class  COpAttrType { Int , Float }
 Tensorflow attribute type Refer to https://www.tensorflow.org/guide/extend/op#attr_types. More...
 

Functions

 INSTANTIATE (loco::DataType::S32)
 
 INSTANTIATE (loco::DataType::FLOAT32)
 
void set_new_shape (locoex::TFLReshape *node, int32_t *base, uint32_t size)
 Set both TFLReshape's 2nd input as TFLConst, and newShape attribute with same value.
 

Enumeration Type Documentation

◆ CircleNodeTrait

enum class locoex::CircleNodeTrait
strong

enumeration of mixin class

Enumerator
FusedActFunc 

Definition at line 32 of file CircleNodes.h.

33{
35};

◆ CircleOpcode

enum class locoex::CircleOpcode
strong
Enumerator
CIRCLE_NODE 

Definition at line 23 of file CircleOpcode.h.

24{
25#define CIRCLE_NODE(OPCODE, CLASS) OPCODE,
26#include "CircleNodes.lst"
27#undef CIRCLE_NODE
28};

◆ COpAttrType

enum class locoex::COpAttrType
strong

Tensorflow attribute type Refer to https://www.tensorflow.org/guide/extend/op#attr_types.

Enumerator
Int 
Float 

Definition at line 29 of file COpAttrTypes.h.

30{
31 Int,
32 Float,
33 // TODO Support more attr types such as String, Bool, DataType, Tensor, Shape, List
34};

◆ FusedActFunc

enum class locoex::FusedActFunc
strong
Enumerator
UNDEFINED 
NONE 
RELU 
RELU6 

Definition at line 24 of file FusedActFunc.h.

25{
26 UNDEFINED, // This is not defined by TFLite or Circle. This was added to
27 // prevent programming error.
28 NONE,
29 RELU,
30 RELU6
31};

◆ Padding

enum class locoex::Padding
strong
Enumerator
UNDEFINED 
SAME 
VALID 

Definition at line 37 of file TFLNodes.h.

38{
39 UNDEFINED, // This is not defined by TFLite. This was added to prevent programming error.
40 SAME,
41 VALID,
42};

◆ TFLNodeTrait

enum class locoex::TFLNodeTrait
strong

enumeration of mixin class

Enumerator
FusedActFunc 
Bias 

Definition at line 77 of file TFLNodes.h.

◆ TFLOpcode

enum class locoex::TFLOpcode
strong
Enumerator
TFL_NODE 

Definition at line 23 of file TFLOpcode.h.

24{
25#define TFL_NODE(OPCODE, CLASS) OPCODE,
26#include "TFLNodes.lst"
27#undef TFL_NODE
28};

Function Documentation

◆ INSTANTIATE() [1/2]

locoex::INSTANTIATE ( loco::DataType::FLOAT32  )

◆ INSTANTIATE() [2/2]

locoex::INSTANTIATE ( loco::DataType::S32  )

◆ set_new_shape()

void locoex::set_new_shape ( locoex::TFLReshape node,
int32_t *  base,
uint32_t  size 
)

Set both TFLReshape's 2nd input as TFLConst, and newShape attribute with same value.

Note
Shape inference for TFLReshape forces them to be same TODO find better place for this helper

Definition at line 67 of file TFLNodes.cpp.

68{
69 // Check node does not have both of new shape infos
70 EXO_ASSERT(node->shape() == nullptr, "node already has shape input");
71 EXO_ASSERT(node->newShape()->rank() == 0, "node already has newShape attribute");
72
73 const loco::DataType S32 = loco::DataType::S32;
74
75 // Set 2nd input as TFLConst
76 auto const_shape_node = node->graph()->nodes()->create<locoex::TFLConst>();
77 const_shape_node->rank(1);
78 const_shape_node->dim(0) = size;
79 const_shape_node->dtype(S32);
80 const_shape_node->size<S32>(size);
81 for (uint32_t axis = 0; axis < size; ++axis)
82 const_shape_node->at<S32>(axis) = base[axis];
83 node->shape(const_shape_node);
84
85 // Set newShape attribute
86 node->newShape()->rank(size);
87 for (uint32_t axis = 0; axis < size; ++axis)
88 node->newShape()->dim(axis) = base[axis];
89}
NodeContext * nodes(void)
Definition Graph.h:218
Graph * graph(void)
Definition Node.h:70
Derived * create(Args &&...args)
Definition NodePool.h:37
Class to build tensor data.
Definition TFLNodes.h:198
uint32_t size(void) const
Definition TFLNodes.cpp:28
int32_t dim(uint32_t n) const
Definition TFLNodes.h:425
uint32_t rank(void) const
Definition TFLNodes.h:422
const Shape * newShape(void) const
Definition TFLNodes.h:432
loco::Node * shape(void) const
Definition TFLNodes.h:415
#define EXO_ASSERT(condition, msg)
Definition Check.h:28
DataType
"scalar" value type
Definition DataType.h:27
int32_t size[5]
Definition Slice.cpp:35

References loco::NodePool::create(), locoex::TFLReshape::Shape::dim(), EXO_ASSERT, loco::Node::graph(), locoex::TFLReshape::newShape(), loco::Graph::nodes(), locoex::TFLReshape::Shape::rank(), locoex::TFLReshape::shape(), locoex::TFLConst::size(), and size.

Referenced by exo::DepthwiseConv2DConverter::convert().