1 //
2 // Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #include "FloorLayer.hpp"
6
7 #include "LayerCloneBase.hpp"
8
9 #include <armnn/TypesUtils.hpp>
10 #include <armnn/backends/WorkloadData.hpp>
11 #include <armnn/backends/WorkloadFactory.hpp>
12
13 namespace armnn
14 {
15
FloorLayer(const char * name)16 FloorLayer::FloorLayer(const char* name)
17 : Layer(1, 1, LayerType::Floor, name)
18 {
19 }
20
CreateWorkload(const IWorkloadFactory & factory) const21 std::unique_ptr<IWorkload> FloorLayer::CreateWorkload(const IWorkloadFactory& factory) const
22 {
23 FloorQueueDescriptor descriptor;
24 SetAdditionalInfo(descriptor);
25
26 return factory.CreateWorkload(LayerType::Floor, descriptor, PrepInfoAndDesc(descriptor));
27 }
28
Clone(Graph & graph) const29 FloorLayer* FloorLayer::Clone(Graph& graph) const
30 {
31 return CloneBase<FloorLayer>(graph, GetName());
32 }
33
ValidateTensorShapesFromInputs()34 void FloorLayer::ValidateTensorShapesFromInputs()
35 {
36 VerifyLayerConnections(1, CHECK_LOCATION());
37
38 const TensorShape& outputShape = GetOutputSlot(0).GetTensorInfo().GetShape();
39
40 VerifyShapeInferenceType(outputShape, m_ShapeInferenceMethod);
41
42 auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
43 ARMNN_ASSERT(inferredShapes.size() == 1);
44
45 ValidateAndCopyShape(outputShape, inferredShapes[0], m_ShapeInferenceMethod, "FloorLayer");
46 }
47
ExecuteStrategy(IStrategy & strategy) const48 void FloorLayer::ExecuteStrategy(IStrategy& strategy) const
49 {
50 strategy.ExecuteStrategy(this, GetParameters(), {}, GetName());
51 }
52
53 } // namespace armnn
54