ArmNN  NotReleased
OptimizeInversePermutesImpl Class Reference

#include <OptimizeInversePermutes.hpp>

Public Member Functions

void Run (Graph &graph, InputSlot &connection) const
 

Protected Member Functions

 OptimizeInversePermutesImpl ()=default
 
 ~OptimizeInversePermutesImpl ()=default
 

Detailed Description

Definition at line 16 of file OptimizeInversePermutes.hpp.

Constructor & Destructor Documentation

◆ OptimizeInversePermutesImpl()

◆ ~OptimizeInversePermutesImpl()

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 21 of file OptimizeInversePermutes.hpp.

References InputSlot::GetConnectedOutputSlot(), Layer::GetInputSlot(), Layer::GetOutputSlot(), InputSlot::GetOwningLayer(), OutputSlot::GetOwningLayer(), OutputSlot::MoveAllConnections(), OptimizeInversePermutesImpl::OptimizeInversePermutesImpl(), and OptimizeInversePermutesImpl::~OptimizeInversePermutesImpl().

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

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