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