ArmNN
 24.08
OptimizeInversePermutesImpl< PermuteType > Class Template Reference

#include <OptimizeInversePermutes.hpp>

Public Member Functions

void Run (Graph &graph, InputSlot &connection) const
 Run for every connection between a base PermuteLayer and a child PermuteLayer. More...
 

Protected Member Functions

 OptimizeInversePermutesImpl ()=default
 
 ~OptimizeInversePermutesImpl ()=default
 

Detailed Description

template<typename PermuteType>
class armnn::optimizations::OptimizeInversePermutesImpl< PermuteType >

Definition at line 18 of file OptimizeInversePermutes.hpp.

Constructor & Destructor Documentation

◆ OptimizeInversePermutesImpl()

OptimizeInversePermutesImpl ( )
protecteddefault

◆ ~OptimizeInversePermutesImpl()

~OptimizeInversePermutesImpl ( )
protecteddefault

Member Function Documentation

◆ Run()

void Run ( Graph graph,
InputSlot connection 
) const
inline

Run for every connection between a base PermuteLayer and a child PermuteLayer.

Bypasses both layers for that connection if one is the inverse of the other.

Definition at line 23 of file OptimizeInversePermutes.hpp.

24  {
25  IgnoreUnused(graph);
26  Layer& base = connection.GetConnectedOutputSlot()->GetOwningLayer();
27  auto child = PolymorphicDowncast<PermuteType*>(&connection.GetOwningLayer());
28 
29  if (child->IsInverse(*PolymorphicDowncast<PermuteType*>(&base)))
30  {
31  // Bypass both layers. Child will be removed as it's left unconnected.
32  // Base layer will be removed if left unconnected.
33  child->GetOutputSlot().MoveAllConnections(*base.GetInputSlot(0).GetConnectedOutputSlot());
34  }
35  }

References InputSlot::GetConnectedOutputSlot(), Layer::GetInputSlot(), InputSlot::GetOwningLayer(), OutputSlot::GetOwningLayer(), and armnn::IgnoreUnused().


The documentation for this class was generated from the following file:
armnn::IgnoreUnused
void IgnoreUnused(Ts &&...)
Definition: IgnoreUnused.hpp:14