surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 1 | // |
Finn Williams | 87d0bda | 2020-07-03 10:12:03 +0100 | [diff] [blame] | 2 | // Copyright © 2017 Arm Ltd and Contributors. All rights reserved. |
David Beck | ecb56cd | 2018-09-05 12:52:57 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 4 | // |
| 5 | #include "FloorLayer.hpp" |
| 6 | |
| 7 | #include "LayerCloneBase.hpp" |
| 8 | |
| 9 | #include <armnn/TypesUtils.hpp> |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 10 | #include <backendsCommon/WorkloadData.hpp> |
| 11 | #include <backendsCommon/WorkloadFactory.hpp> |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 12 | |
| 13 | namespace armnn |
| 14 | { |
| 15 | |
| 16 | FloorLayer::FloorLayer(const char* name) |
| 17 | : Layer(1, 1, LayerType::Floor, name) |
| 18 | { |
| 19 | } |
| 20 | |
Derek Lamberti | 94a88d2 | 2019-12-10 21:12:59 +0000 | [diff] [blame] | 21 | std::unique_ptr<IWorkload> FloorLayer::CreateWorkload(const IWorkloadFactory& factory) const |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 22 | { |
| 23 | FloorQueueDescriptor descriptor; |
Derek Lamberti | 94a88d2 | 2019-12-10 21:12:59 +0000 | [diff] [blame] | 24 | return factory.CreateFloor(descriptor, PrepInfoAndDesc(descriptor)); |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | FloorLayer* FloorLayer::Clone(Graph& graph) const |
| 28 | { |
| 29 | return CloneBase<FloorLayer>(graph, GetName()); |
| 30 | } |
| 31 | |
Finn Williams | f24effa | 2020-07-03 10:12:03 +0100 | [diff] [blame^] | 32 | void FloorLayer::ValidateTensorShapesFromInputs() |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 33 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 34 | VerifyLayerConnections(1, CHECK_LOCATION()); |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 35 | |
Finn Williams | 87d0bda | 2020-07-03 10:12:03 +0100 | [diff] [blame] | 36 | const TensorShape& outputShape = GetOutputSlot(0).GetTensorInfo().GetShape(); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 37 | |
Finn Williams | f24effa | 2020-07-03 10:12:03 +0100 | [diff] [blame^] | 38 | VerifyShapeInferenceType(outputShape, m_ShapeInferenceMethod); |
Finn Williams | 87d0bda | 2020-07-03 10:12:03 +0100 | [diff] [blame] | 39 | |
| 40 | auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() }); |
Narumol Prangnawarat | ac2770a | 2020-04-01 16:51:23 +0100 | [diff] [blame] | 41 | ARMNN_ASSERT(inferredShapes.size() == 1); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 42 | |
Finn Williams | f24effa | 2020-07-03 10:12:03 +0100 | [diff] [blame^] | 43 | ValidateAndCopyShape(outputShape, inferredShapes[0], m_ShapeInferenceMethod, "FloorLayer"); |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 44 | } |
| 45 | |
jimfly01 | e9e7bfd | 2019-01-24 22:29:33 +0000 | [diff] [blame] | 46 | void FloorLayer::Accept(ILayerVisitor& visitor) const |
| 47 | { |
| 48 | visitor.VisitFloorLayer(this, GetName()); |
| 49 | } |
| 50 | |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 51 | } // namespace armnn |