24.08
|
Go to the documentation of this file.
11 namespace optimizations
20 if (IsReshape(transpose))
24 const std::string name = std::string(
"as_reshape-") + transpose.
GetName();
44 const unsigned int numDimensions = permutation.
GetSize();
45 std::map<unsigned int, unsigned int> permuteMappings;
46 for (
unsigned int i = 0; i < permutation.
GetSize(); ++i)
48 permuteMappings[permutation[i]] = i;
51 std::vector<unsigned int> permuteVector;
52 for (
unsigned int i = 0; i < permutation.
GetSize(); ++i)
54 permuteVector.push_back(permuteMappings.at(i));
57 unsigned int lastGtOne = 0;
58 while ((lastGtOne < numDimensions) && (outShape[(permuteVector[lastGtOne])] == 1U))
63 bool isReshape =
true;
64 for (
unsigned int i = lastGtOne + 1U; isReshape && (i < numDimensions); ++i)
66 if (outShape[permuteVector[i]] > 1U)
68 isReshape = permuteVector[lastGtOne] < permuteVector[i];
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 transpose operation.
This layer represents a reshape operation.
A ReshapeDescriptor for the ReshapeLayer.
~TransposeAsReshapeImpl()=default
const OutputHandler & GetOutputHandler(unsigned int i=0) const
TransposeAsReshapeImpl()=default
void MoveAllConnections(OutputSlot &destination)
Moves all connections to another OutputSlot.
const PermutationVector & GetPermutation() const
const TensorShape & GetShape() const
Copyright (c) 2021 ARM Limited and Contributors.
const TensorInfo & GetTensorInfo() const
Gets the matching TensorInfo for the output.
void Run(Graph &graph, TransposeLayer &transpose) const
Run for every TransposeLayer. 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...