ONE - On-device Neural Engine
Loading...
Searching...
No Matches
exo::TensorConcatConverter Class Reference

Convert loco::TensorConcat to TFLConcatenate. More...

#include <TensorConcatConverter.h>

Collaboration diagram for exo::TensorConcatConverter:

Public Member Functions

const char * name (void) const final
 
bool convert (loco::TensorConcat *origin) final
 Converts loco::TensorConcat to locoex::TFLConcatenate.
 
- Public Member Functions inherited from exo::CanonicalNodeConverter< loco::TensorConcat >
bool run (loco::Graph *graph)
 Run the pass.
 
- Public Member Functions inherited from logo::Pass
virtual ~Pass ()=default
 

Additional Inherited Members

Detailed Description

Convert loco::TensorConcat to TFLConcatenate.

Definition at line 30 of file TensorConcatConverter.h.

Member Function Documentation

◆ convert()

bool exo::TensorConcatConverter::convert ( loco::TensorConcat origin)
finalvirtual

Converts loco::TensorConcat to locoex::TFLConcatenate.

Before: input:0 --— loco::TensorConcat ----— C input:1 -—/

After: input:0 --— locoex::TFLConcatenate — C input:1 -—/

input:0 --— loco::TensorConcat — input:1 -—/

Implements exo::CanonicalNodeConverter< loco::TensorConcat >.

Definition at line 43 of file TensorConcatConverter.cpp.

44{
45 assert(loco::shape_get(origin).domain() == loco::Domain::Tensor);
46
47 if (!loco::shape_known(origin))
48 {
49 return false;
50 }
51
52 auto tfl_concat = origin->graph()->nodes()->create<locoex::TFLConcatenation>(2);
53 tfl_concat->values(0, origin->lhs());
54 tfl_concat->values(1, origin->rhs());
55 tfl_concat->axis(origin->axis());
56 tfl_concat->fusedActivationFunction(locoex::FusedActFunc::NONE);
57
58 loco::replace(origin).with(tfl_concat);
59
60 origin->lhs(nullptr);
61 origin->rhs(nullptr);
62
63 return true;
64}
NodeContext * nodes(void)
Definition Graph.h:218
Graph * graph(void)
Definition Node.h:70
Derived * create(Args &&...args)
Definition NodePool.h:37
void with(Node *into) const
Definition Node.cpp:66
uint32_t axis(void) const
Definition Nodes.h:542
Node * rhs(void) const
Definition Nodes.h:538
Node * lhs(void) const
Definition Nodes.h:535
CONCATENATION in TensorFlow Lite.
Definition TFLNodes.h:160
Node * values(uint32_t index) const
Definition TFLNodes.h:172
bool shape_known(const Node *node)
NodeShape shape_get(const Node *node)
Subst< SubstQualifier::Default > replace(Node *node)
Definition Node.cpp:82

References loco::TensorConcat::axis(), loco::NodePool::create(), loco::Node::graph(), loco::TensorConcat::lhs(), loco::Graph::nodes(), locoex::NONE, loco::replace(), loco::TensorConcat::rhs(), loco::shape_get(), loco::shape_known(), loco::Tensor, locoex::TFLConcatenation::values(), and loco::Subst< SubstQualifier::Default >::with().

◆ name()

const char * exo::TensorConcatConverter::name ( void  ) const
inlinefinalvirtual

Reimplemented from exo::CanonicalNodeConverter< loco::TensorConcat >.

Definition at line 33 of file TensorConcatConverter.h.

33{ return "exo::TensorConcatConverter"; }

The documentation for this class was generated from the following files: