ArmNN
 24.08
RankLayer.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2020-2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include <Layer.hpp>
9 
10 namespace armnn
11 {
12 
13 class RankLayer : public Layer
14 {
15 public:
16  /// Makes a workload for the Rank type.
17  /// @param [in] factory The workload factory which will create the workload.
18  /// @return A pointer to the created workload, or nullptr if not created.
19  virtual std::unique_ptr<IWorkload> CreateWorkload(const IWorkloadFactory& factory) const override;
20 
21  /// Creates a dynamically-allocated copy of this layer.
22  /// @param [in] graph The graph into which this layer is being cloned.
23  Layer* Clone(Graph& graph) const override;
24 
25  /// Check if the input tensor shape(s)
26  /// will lead to a valid configuration of @ref RankLayer.
27  /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
28  void ValidateTensorShapesFromInputs() override;
29 
30  /// Rank returns a scalar specifying the rank of the input tensor. The rank of a tensor is the number
31  /// of dimensions it has.
32  /// @param [in] inputShapes The input shapes layer has. This is ignored for Rank.
33  /// @return A vector to the inferred output shape.
34  std::vector<TensorShape> InferOutputShapes(const std::vector<TensorShape>& inputShapes) const override;
35 
36  void ExecuteStrategy(IStrategy& strategy) const override;
37 
38 protected:
39  /// Constructor to create a RankLayer.
40  /// @param [in] name Optional name for the layer.
41  RankLayer(const char* name);
42 
43  /// Default destructor
44  ~RankLayer() = default;
45 };
46 
47 } //namespace armnn
48 
49 
armnn::RankLayer
Definition: RankLayer.hpp:13
armnn::RankLayer::RankLayer
RankLayer(const char *name)
Constructor to create a RankLayer.
Definition: RankLayer.cpp:16
armnn::RankLayer::InferOutputShapes
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
Rank returns a scalar specifying the rank of the input tensor.
Definition: RankLayer.cpp:34
armnn::IStrategy
Definition: IStrategy.hpp:16
armnn::RankLayer::ExecuteStrategy
void ExecuteStrategy(IStrategy &strategy) const override
Apply a visitor to this layer.
Definition: RankLayer.cpp:50
armnn::Layer
Definition: Layer.hpp:230
armnn::IWorkloadFactory
Definition: WorkloadFactory.hpp:22
armnn::RankLayer::CreateWorkload
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Makes a workload for the Rank type.
Definition: RankLayer.cpp:20
armnn::RankLayer::ValidateTensorShapesFromInputs
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s) will lead to a valid configuration of RankLayer.
Definition: RankLayer.cpp:39
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
Layer.hpp
armnn::RankLayer::~RankLayer
~RankLayer()=default
Default destructor.
armnn::RankLayer::Clone
Layer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
Definition: RankLayer.cpp:28
armnn::Graph
Definition: Graph.hpp:30