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().