ArmNN
 24.08
OptimizeInverseConversionsImpl Class Reference

#include <OptimizeInverseConversions.hpp>

Public Member Functions

void Run (Graph &graph, InputSlot &connection) const
 Run for every connection between two inverse data type conversion layers, i.e. More...
 

Protected Member Functions

 OptimizeInverseConversionsImpl ()=default
 
 ~OptimizeInverseConversionsImpl ()=default
 

Detailed Description

Definition at line 16 of file OptimizeInverseConversions.hpp.

Constructor & Destructor Documentation

◆ OptimizeInverseConversionsImpl()

OptimizeInverseConversionsImpl ( )
protecteddefault

◆ ~OptimizeInverseConversionsImpl()

~OptimizeInverseConversionsImpl ( )
protecteddefault

Member Function Documentation

◆ Run()

void Run ( Graph graph,
InputSlot connection 
) const
inline

Run for every connection between two inverse data type conversion layers, i.e.

Fp16ToFp32 followed by Fp32ToFp16 or vice-versa.

Definition at line 21 of file OptimizeInverseConversions.hpp.

22  {
23  IgnoreUnused(graph);
24  Layer& base = connection.GetConnectedOutputSlot()->GetOwningLayer();
25  Layer& child = connection.GetOwningLayer();
26 
27  ARMNN_ASSERT((base.GetType() == LayerType::ConvertFp16ToFp32 &&
28  child.GetType() == LayerType::ConvertFp32ToFp16) ||
29  (base.GetType() == LayerType::ConvertFp32ToFp16 &&
30  child.GetType() == LayerType::ConvertFp16ToFp32));
31 
32  // Bypass both conversion layers
33  child.GetOutputSlot().MoveAllConnections(*base.GetInputSlot(0).GetConnectedOutputSlot());
34  }

References ARMNN_ASSERT, armnn::ConvertFp16ToFp32, armnn::ConvertFp32ToFp16, InputSlot::GetConnectedOutputSlot(), Layer::GetInputSlot(), Layer::GetOutputSlot(), InputSlot::GetOwningLayer(), OutputSlot::GetOwningLayer(), Layer::GetType(), armnn::IgnoreUnused(), and OutputSlot::MoveAllConnections().


The documentation for this class was generated from the following file:
ARMNN_ASSERT
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
armnn::LayerType::ConvertFp16ToFp32
@ ConvertFp16ToFp32
armnn::LayerType::ConvertFp32ToFp16
@ ConvertFp32ToFp16
armnn::IgnoreUnused
void IgnoreUnused(Ts &&...)
Definition: IgnoreUnused.hpp:14