11 namespace optimizations
20 if (IsReshape(permute))
24 const std::string name = std::string(
"as_reshape-") + permute.
GetName();
45 const unsigned int numDimensions = permutation.
GetSize();
47 unsigned int lastGtOne = 0;
48 while ((lastGtOne < numDimensions) && (outShape[(permutation[lastGtOne])] == 1U))
53 bool isReshape =
true;
54 for (
unsigned int i = lastGtOne + 1U; isReshape && (i < numDimensions); ++i)
56 if (outShape[permutation[i]] > 1U)
58 isReshape = permutation[lastGtOne] < permutation[i];
const TensorShape & GetShape() const
A ReshapeDescriptor for the ReshapeLayer.
This layer represents a reshape operation.
PermuteAsReshapeImpl()=default
Copyright (c) 2020 ARM Limited.
This layer represents a permutation operation.
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
~PermuteAsReshapeImpl()=default
void SetTensorInfo(const TensorInfo &tensorInfo)
Sets the TensorInfo used by this output handler.
const PermutationVector & GetPermutation() const
const OutputHandler & GetOutputHandler(unsigned int i=0) const
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
const char * GetName() const override
Returns the name of the layer.
void Run(Graph &graph, PermuteLayer &permute) const
Run for every PermuteLayer. Replaces it with a ReshapeLayer if they are equivalent.
LayerT * InsertNewLayer(InputSlot &insertBefore, Args &&... args)
Inserts a new layer between the output slot currently connected to insertBefore and insertBefore itse...
void MoveAllConnections(OutputSlot &destination)
Moves all connections to another OutputSlot.
const TensorInfo & GetTensorInfo() const
Gets the matching TensorInfo for the output.