ArmNN
 25.11
Loading...
Searching...
No Matches
PermuteAsReshapeImpl Class Reference

#include <PermuteAsReshape.hpp>

Public Member Functions

void Run (Graph &graph, PermuteLayer &permute) const
 Run for every PermuteLayer. Replaces it with a ReshapeLayer if they are equivalent.

Protected Member Functions

 PermuteAsReshapeImpl ()=default
 ~PermuteAsReshapeImpl ()=default

Detailed Description

Definition at line 14 of file PermuteAsReshape.hpp.

Constructor & Destructor Documentation

◆ PermuteAsReshapeImpl()

PermuteAsReshapeImpl ( )
protecteddefault

◆ ~PermuteAsReshapeImpl()

Member Function Documentation

◆ Run()

void Run ( Graph & graph,
PermuteLayer & permute ) const
inline

Run for every PermuteLayer. Replaces it with a ReshapeLayer if they are equivalent.

Definition at line 18 of file PermuteAsReshape.hpp.

19 {
20 if (IsReshape(permute))
21 {
22 const TensorInfo& outInfo = permute.GetOutputHandler().GetTensorInfo();
23
24 const std::string name = std::string("as_reshape-") + permute.GetName();
25 const ReshapeDescriptor descriptor{outInfo.GetShape()};
26 // Inserts NewLayer so layers don't need to be re-sorted.
27 auto reshape = graph.InsertNewLayer<ReshapeLayer>(permute.GetInputSlot(0), descriptor, name.c_str());
28
29 // Bypass permute. It will be deleted since it's left unconnected.
30 permute.GetOutputSlot().MoveAllConnections(reshape->GetOutputSlot());
31 }
32 }

References Layer::GetInputSlot(), Layer::GetName(), Layer::GetOutputHandler(), Layer::GetOutputSlot(), TensorInfo::GetShape(), OutputHandler::GetTensorInfo(), Graph::InsertNewLayer(), and OutputSlot::MoveAllConnections().


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