HDlPrune.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /***********************************************************
  2. * File generated by the HALCON-Compiler hcomp version 20.11
  3. * Usage: Interface to C++
  4. *
  5. * Software by: MVTec Software GmbH, www.mvtec.com
  6. ***********************************************************/
  7. #ifndef HCPP_HDLPRUNE
  8. #define HCPP_HDLPRUNE
  9. namespace HalconCpp
  10. {
  11. // Represents an instance of the parameter information for pruning a Deep Neural Network model.
  12. class LIntExport HDlPrune : public HHandle
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HDlPrune():HHandle() {}
  17. // Copy constructor
  18. HDlPrune(const HDlPrune& source) : HHandle(source) {}
  19. // Copy constructor
  20. HDlPrune(const HHandle& handle);
  21. // Create HDlPrune from handle, taking ownership
  22. explicit HDlPrune(Hlong handle);
  23. bool operator==(const HHandle& obj) const
  24. {
  25. return HHandleBase::operator==(obj);
  26. }
  27. bool operator!=(const HHandle& obj) const
  28. {
  29. return HHandleBase::operator!=(obj);
  30. }
  31. protected:
  32. // Verify matching semantic type ('dl_pruning')!
  33. virtual void AssertType(Hphandle handle) const;
  34. public:
  35. /*****************************************************************************
  36. * Operator-based class constructors
  37. *****************************************************************************/
  38. // create_dl_pruning: Create a pruning data handle.
  39. explicit HDlPrune(const HDlModel& DLModelHandle, const HString& Mode, const HDict& GenParam);
  40. // create_dl_pruning: Create a pruning data handle.
  41. explicit HDlPrune(const HDlModel& DLModelHandle, const char* Mode, const HDict& GenParam);
  42. #ifdef _WIN32
  43. // create_dl_pruning: Create a pruning data handle.
  44. explicit HDlPrune(const HDlModel& DLModelHandle, const wchar_t* Mode, const HDict& GenParam);
  45. #endif
  46. /***************************************************************************
  47. * Operators *
  48. ***************************************************************************/
  49. // Calculate scores to prune a deep learning model.
  50. void AddDlPruningBatch(const HDlModel& DLModelHandleToPrune, const HDictArray& DLSampleBatch) const;
  51. // Create a pruning data handle.
  52. void CreateDlPruning(const HDlModel& DLModelHandle, const HString& Mode, const HDict& GenParam);
  53. // Create a pruning data handle.
  54. void CreateDlPruning(const HDlModel& DLModelHandle, const char* Mode, const HDict& GenParam);
  55. #ifdef _WIN32
  56. // Create a pruning data handle.
  57. void CreateDlPruning(const HDlModel& DLModelHandle, const wchar_t* Mode, const HDict& GenParam);
  58. #endif
  59. // Get information from a pruning data handle.
  60. HTuple GetDlPruningParam(const HString& GenParamName) const;
  61. // Get information from a pruning data handle.
  62. HTuple GetDlPruningParam(const char* GenParamName) const;
  63. #ifdef _WIN32
  64. // Get information from a pruning data handle.
  65. HTuple GetDlPruningParam(const wchar_t* GenParamName) const;
  66. #endif
  67. // Set parameter in a pruning data handle.
  68. void SetDlPruningParam(const HString& GenParamName, const HTuple& GenParamValue) const;
  69. // Set parameter in a pruning data handle.
  70. void SetDlPruningParam(const HString& GenParamName, double GenParamValue) const;
  71. // Set parameter in a pruning data handle.
  72. void SetDlPruningParam(const char* GenParamName, double GenParamValue) const;
  73. #ifdef _WIN32
  74. // Set parameter in a pruning data handle.
  75. void SetDlPruningParam(const wchar_t* GenParamName, double GenParamValue) const;
  76. #endif
  77. };
  78. // forward declarations and types for internal array implementation
  79. template<class T> class HSmartPtr;
  80. template<class T> class HHandleBaseArrayRef;
  81. typedef HHandleBaseArrayRef<HDlPrune> HDlPruneArrayRef;
  82. typedef HSmartPtr< HDlPruneArrayRef > HDlPruneArrayPtr;
  83. // Represents multiple tool instances
  84. class LIntExport HDlPruneArray : public HHandleBaseArray
  85. {
  86. public:
  87. // Create empty array
  88. HDlPruneArray();
  89. // Create array from native array of tool instances
  90. HDlPruneArray(HDlPrune* classes, Hlong length);
  91. // Copy constructor
  92. HDlPruneArray(const HDlPruneArray &tool_array);
  93. // Destructor
  94. virtual ~HDlPruneArray();
  95. // Assignment operator
  96. HDlPruneArray &operator=(const HDlPruneArray &tool_array);
  97. // Clears array and all tool instances
  98. virtual void Clear();
  99. // Get array of native tool instances
  100. const HDlPrune* Tools() const;
  101. // Get number of tools
  102. virtual Hlong Length() const;
  103. // Create tool array from tuple of handles
  104. virtual void SetFromTuple(const HTuple& handles);
  105. // Get tuple of handles for tool array
  106. virtual HTuple ConvertToTuple() const;
  107. protected:
  108. // Smart pointer to internal data container
  109. HDlPruneArrayPtr *mArrayPtr;
  110. };
  111. }
  112. #endif