2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
6 #include "ConvertFp16ToFp32Layer.hpp"
7 #include "LayerCloneBase.hpp"
9 #include <armnn/TypesUtils.hpp>
11 #include <backendsCommon/WorkloadData.hpp>
12 #include <backendsCommon/WorkloadFactory.hpp>
17 ConvertFp16ToFp32Layer::ConvertFp16ToFp32Layer(const char* name)
18 : Layer(1, 1, LayerType::ConvertFp16ToFp32, name)
22 std::unique_ptr<IWorkload> ConvertFp16ToFp32Layer::CreateWorkload(const Graph& graph,
23 const IWorkloadFactory& factory) const
25 ConvertFp16ToFp32QueueDescriptor descriptor;
26 return factory.CreateConvertFp16ToFp32(descriptor, PrepInfoAndDesc(descriptor, graph));
29 ConvertFp16ToFp32Layer* ConvertFp16ToFp32Layer::Clone(Graph& graph) const
31 return CloneBase<ConvertFp16ToFp32Layer>(graph, GetName());
34 void ConvertFp16ToFp32Layer::ValidateTensorShapesFromInputs()
36 VerifyLayerConnections(1, CHECK_LOCATION());
38 auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
40 BOOST_ASSERT(inferredShapes.size() == 1);
42 ConditionalThrowIfNotEqual<LayerValidationException>(
43 "ConvertFp16ToFp32Layer: TensorShape set on OutputSlot[0] does not match the inferred shape.",
44 GetOutputSlot(0).GetTensorInfo().GetShape(),