ArmNN
 24.08
DeleteBroadcastToImpl Class Reference

#include <DeleteBroadcastTo.hpp>

Public Member Functions

void Run (Graph &, BroadcastToLayer &layer) const
 Run for every BroadcastToLayer. More...
 

Protected Member Functions

 DeleteBroadcastToImpl ()=default
 
 ~DeleteBroadcastToImpl ()=default
 

Detailed Description

Definition at line 13 of file DeleteBroadcastTo.hpp.

Constructor & Destructor Documentation

◆ DeleteBroadcastToImpl()

DeleteBroadcastToImpl ( )
protecteddefault

◆ ~DeleteBroadcastToImpl()

~DeleteBroadcastToImpl ( )
protecteddefault

Member Function Documentation

◆ Run()

void Run ( Graph ,
BroadcastToLayer layer 
) const
inline

Run for every BroadcastToLayer.

Remove it if it is before an ElementWiseLayer. Since ElementWiseBinary uses a brodcastLoop, using a broadcastTo layer is not necessary so it will be deleted.

Definition at line 19 of file DeleteBroadcastTo.hpp.

20  {
21  if(layer.GetType() == LayerType::BroadcastTo)
22  {
23  TensorInfo info = layer.GetOutputSlot(0).GetTensorInfo();
24  Layer& next = layer.GetOutputSlot(0).GetConnection(0)->GetOwningLayer();
25  if (next.GetType() == LayerType::ElementwiseBinary)
26  {
27  Layer& connectedLayer = layer.GetInputSlots()[0].GetConnectedOutputSlot()->GetOwningLayer();
28  auto tensorInfo = connectedLayer.GetOutputSlot().GetTensorInfo();
29  layer.GetOutputSlot().MoveAllConnections(connectedLayer.GetOutputSlot());
30  connectedLayer.GetOutputSlot().GetOutputHandler().SetTensorInfo(tensorInfo);
31  }
32  }
33  }

References armnn::BroadcastTo, armnn::ElementwiseBinary, OutputSlot::GetConnection(), Layer::GetInputSlots(), OutputSlot::GetOutputHandler(), Layer::GetOutputSlot(), InputSlot::GetOwningLayer(), OutputSlot::GetTensorInfo(), Layer::GetType(), armnn::info, OutputSlot::MoveAllConnections(), and OutputHandler::SetTensorInfo().


The documentation for this class was generated from the following file:
armnn::LayerType::ElementwiseBinary
@ ElementwiseBinary
armnn::LayerType::BroadcastTo
@ BroadcastTo
armnn::BoostLogSeverityMapping::info
@ info