NVIDIA NvNeural SDK  2022.2
GPU inference framework for NVIDIA Nsight Deep Learning Designer
ActivationDescHostContainer.h
Go to the documentation of this file.
1 /*
2 * SPDX-FileCopyrightText: Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: MIT
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23 
25 #ifndef NVNEURAL_ACTIVATIONDESCHOSTCONTAINER_H
26 #define NVNEURAL_ACTIVATIONDESCHOSTCONTAINER_H
27 
28 #include <nvneural/CoreTypes.h>
29 #include <nvneural/CoreHelpers.h>
30 #include <vector>
31 
32 namespace nvneural {
39  {
40  private:
41  bool m_validActivationDesc;
42  ActivationDesc m_activationDesc;
43  std::vector<ParamDesc> m_params;
44 
45  void ActivationDescWarning(const std::string& pWarningText) const;
46  bool SanityCheckActivationDesc() const;
47  bool ValidateAndLoadActivationDesc(const ActivationDesc* pInputActivationDesc);
48 
49  bool ValidateAndLoadParamDesc(const ParamDesc* const pInputParamDesc);
50 
51  public:
52  ActivationDescHostContainer() = delete;
53 
57  explicit ActivationDescHostContainer(const ActivationDesc* pInputActivationDesc);
58 
59  ~ActivationDescHostContainer() = default;
60 
62  bool isValid() const
63  {
64  return m_validActivationDesc;
65  }
66 
68  const ActivationDesc& get() const
69  {
70  return m_activationDesc;
71  }
72 
74  void linkVectors()
75  {
76  m_activationDesc.pParameters = m_params.data();
77  }
78  };
79 }
80 
81 #endif // NVNEURAL_ACTIVATIONDESCHOSTCONTAINER_H
Common helper classes and template function implementations.
Fundamental NvNeural data types are declared here.
"Host-native" container for ActivationDesc structures from other modules.
Definition: ActivationDescHostContainer.h:39
bool isValid() const
Returns true if the imported descriptor was valid.
Definition: ActivationDescHostContainer.h:62
const ActivationDesc & get() const
Returns a reference to the converted/upgraded descriptor.
Definition: ActivationDescHostContainer.h:68
void linkVectors()
Once all ParamDescs have been converted, call this to reconnect the parameter list.
Definition: ActivationDescHostContainer.h:74
Structure describing an activation function (IActivationFunction) for tool interfaces and network bui...
Definition: CoreTypes.h:1634
const ParamDesc * pParameters
This is the pointer to the contiguous memory of ParamDesc structs.
Definition: CoreTypes.h:1683
ParamDesc describes a parameter for the plugin, giving it a name, default value, type,...
Definition: CoreTypes.h:1449