ArmNN
 20.05
ConvertFp32ToFp16Layer.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 
7 #include <Layer.hpp>
8 
9 namespace armnn
10 {
11 
12 /// This layer converts data type Float 32 to Float 16.
14 {
15 public:
16  /// Makes a workload for the ConvertFp32ToFp16 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  ConvertFp32ToFp16Layer* Clone(Graph& graph) const override;
24 
25  /// Check if the input tensor shape(s)
26  /// will lead to a valid configuration of @ref ConvertFp32ToFp16Layer.
27  void ValidateTensorShapesFromInputs() override;
28 
29  void Accept(ILayerVisitor& visitor) const override;
30 
31 protected:
32  /// Constructor to create a ConvertFp32ToFp16Layer.
33  /// @param [in] name Optional name for the layer.
34  ConvertFp32ToFp16Layer(const char* name);
35 
36  /// Default destructor
37  ~ConvertFp32ToFp16Layer() = default;
38 };
39 
40 } // namespace
ConvertFp32ToFp16Layer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
ConvertFp32ToFp16Layer(const char *name)
Constructor to create a ConvertFp32ToFp16Layer.
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Makes a workload for the ConvertFp32ToFp16 type.
Copyright (c) 2020 ARM Limited.
void Accept(ILayerVisitor &visitor) const override
Apply a visitor to this layer.
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s) will lead to a valid configuration of ConvertFp32ToFp16Layer.
This layer converts data type Float 32 to Float 16.
~ConvertFp32ToFp16Layer()=default
Default destructor.