ArmNN  NotReleased
PermuteLayer.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
8 
9 namespace armnn
10 {
11 
13 class PermuteLayer : public LayerWithParameters<PermuteDescriptor>
14 {
15 public:
20  virtual std::unique_ptr<IWorkload> CreateWorkload(const IWorkloadFactory& factory) const override;
21 
24  PermuteLayer* Clone(Graph& graph) const override;
25 
28  void ValidateTensorShapesFromInputs() override;
29 
34  std::vector<TensorShape> InferOutputShapes(const std::vector<TensorShape>& inputShapes) const override;
35 
38  {
39  return m_Param.m_DimMappings;
40  }
41 
45  bool IsInverse(const Layer& other) const
46  {
47  return (other.GetType() == LayerType::Permute) &&
48  GetPermutation().IsInverse(boost::polymorphic_downcast<const PermuteLayer*>(&other)->GetPermutation());
49  }
50 
54  bool IsEqual(const Layer& other) const
55  {
56  return (other.GetType() == LayerType::Permute) &&
57  GetPermutation().IsEqual(boost::polymorphic_downcast<const PermuteLayer*>(&other)->GetPermutation());
58  }
59 
60  void Accept(ILayerVisitor& visitor) const override;
61 
62 protected:
66  PermuteLayer(const PermuteDescriptor& param, const char* name);
67 
69  ~PermuteLayer() = default;
70 };
71 
72 } // namespace
bool IsEqual(const Layer &other) const
LayerType GetType() const
Definition: Layer.hpp:259
bool IsEqual(const PermutationVector &other) const
Definition: Types.hpp:204
const PermutationVector & GetPermutation() const
bool IsInverse(const PermutationVector &other) const
Definition: Types.hpp:214
PermuteLayer * Clone(Graph &graph) const override
void ValidateTensorShapesFromInputs() override
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
This layer represents a permutation operation.
PermuteDescriptor m_Param
The parameters for the layer (not including tensor-valued weights etc.).
void Accept(ILayerVisitor &visitor) const override
bool IsInverse(const Layer &other) const
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
PermutationVector m_DimMappings
Indicates how to translate tensor elements from a given source into the target destination, when source and target potentially have different memory layouts e.g. {0U, 3U, 1U, 2U}.
~PermuteLayer()=default
Default destructor.
A PermuteDescriptor for the PermuteLayer.
PermuteLayer(const PermuteDescriptor &param, const char *name)