HDlLayer.h 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  1. /***********************************************************
  2. * File generated by the HALCON-Compiler hcomp version 22.05
  3. * Usage: Interface to C++
  4. *
  5. * Software by: MVTec Software GmbH, www.mvtec.com
  6. ***********************************************************/
  7. #ifndef HCPP_HDLLAYER
  8. #define HCPP_HDLLAYER
  9. namespace HalconCpp
  10. {
  11. // Represents an instance of a Deep Neural Network graph layer.
  12. class LIntExport HDlLayer : public HHandle
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HDlLayer():HHandle() {}
  17. // Copy constructor
  18. HDlLayer(const HDlLayer& source) : HHandle(source) {}
  19. // Copy constructor
  20. HDlLayer(const HHandle& handle);
  21. // Create HDlLayer from handle, taking ownership
  22. explicit HDlLayer(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_layer')!
  33. virtual void AssertType(Hphandle handle) const;
  34. public:
  35. /*****************************************************************************
  36. * Operator-based class constructors
  37. *****************************************************************************/
  38. // create_dl_layer_input: Create an input layer.
  39. explicit HDlLayer(const HString& LayerName, const HTuple& Shape, const HTuple& GenParamName, const HTuple& GenParamValue);
  40. // create_dl_layer_input: Create an input layer.
  41. explicit HDlLayer(const HString& LayerName, const HTuple& Shape, const HString& GenParamName, const HString& GenParamValue);
  42. // create_dl_layer_input: Create an input layer.
  43. explicit HDlLayer(const char* LayerName, const HTuple& Shape, const char* GenParamName, const char* GenParamValue);
  44. #ifdef _WIN32
  45. // create_dl_layer_input: Create an input layer.
  46. explicit HDlLayer(const wchar_t* LayerName, const HTuple& Shape, const wchar_t* GenParamName, const wchar_t* GenParamValue);
  47. #endif
  48. /***************************************************************************
  49. * Operators *
  50. ***************************************************************************/
  51. // Create an activation layer.
  52. HDlLayer CreateDlLayerActivation(const HString& LayerName, const HString& ActivationType, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  53. // Create an activation layer.
  54. HDlLayer CreateDlLayerActivation(const HString& LayerName, const HString& ActivationType, const HString& GenParamName, const HString& GenParamValue) const;
  55. // Create an activation layer.
  56. HDlLayer CreateDlLayerActivation(const char* LayerName, const char* ActivationType, const char* GenParamName, const char* GenParamValue) const;
  57. #ifdef _WIN32
  58. // Create an activation layer.
  59. HDlLayer CreateDlLayerActivation(const wchar_t* LayerName, const wchar_t* ActivationType, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  60. #endif
  61. // Create a batch normalization layer.
  62. HDlLayer CreateDlLayerBatchNormalization(const HString& LayerName, const HTuple& Momentum, double Epsilon, const HString& Activation, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  63. // Create a batch normalization layer.
  64. HDlLayer CreateDlLayerBatchNormalization(const HString& LayerName, const HString& Momentum, double Epsilon, const HString& Activation, const HString& GenParamName, const HString& GenParamValue) const;
  65. // Create a batch normalization layer.
  66. HDlLayer CreateDlLayerBatchNormalization(const char* LayerName, const char* Momentum, double Epsilon, const char* Activation, const char* GenParamName, const char* GenParamValue) const;
  67. #ifdef _WIN32
  68. // Create a batch normalization layer.
  69. HDlLayer CreateDlLayerBatchNormalization(const wchar_t* LayerName, const wchar_t* Momentum, double Epsilon, const wchar_t* Activation, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  70. #endif
  71. // Create a class ID conversion layer.
  72. HDlLayer CreateDlLayerClassIdConversion(const HString& LayerName, const HString& ConversionMode, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  73. // Create a class ID conversion layer.
  74. HDlLayer CreateDlLayerClassIdConversion(const HString& LayerName, const HString& ConversionMode, const HString& GenParamName, const HString& GenParamValue) const;
  75. // Create a class ID conversion layer.
  76. HDlLayer CreateDlLayerClassIdConversion(const char* LayerName, const char* ConversionMode, const char* GenParamName, const char* GenParamValue) const;
  77. #ifdef _WIN32
  78. // Create a class ID conversion layer.
  79. HDlLayer CreateDlLayerClassIdConversion(const wchar_t* LayerName, const wchar_t* ConversionMode, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  80. #endif
  81. // Create a concatenation layer.
  82. static HDlLayer CreateDlLayerConcat(const HDlLayerArray& DLLayerInputs, const HString& LayerName, const HString& Axis, const HTuple& GenParamName, const HTuple& GenParamValue);
  83. // Create a concatenation layer.
  84. HDlLayer CreateDlLayerConcat(const HString& LayerName, const HString& Axis, const HString& GenParamName, const HString& GenParamValue) const;
  85. // Create a concatenation layer.
  86. HDlLayer CreateDlLayerConcat(const char* LayerName, const char* Axis, const char* GenParamName, const char* GenParamValue) const;
  87. #ifdef _WIN32
  88. // Create a concatenation layer.
  89. HDlLayer CreateDlLayerConcat(const wchar_t* LayerName, const wchar_t* Axis, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  90. #endif
  91. // Create a convolutional layer.
  92. HDlLayer CreateDlLayerConvolution(const HString& LayerName, const HTuple& KernelSize, const HTuple& Dilation, const HTuple& Stride, Hlong NumKernel, Hlong Groups, const HTuple& Padding, const HString& Activation, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  93. // Create a convolutional layer.
  94. HDlLayer CreateDlLayerConvolution(const HString& LayerName, Hlong KernelSize, Hlong Dilation, Hlong Stride, Hlong NumKernel, Hlong Groups, const HString& Padding, const HString& Activation, const HString& GenParamName, const HString& GenParamValue) const;
  95. // Create a convolutional layer.
  96. HDlLayer CreateDlLayerConvolution(const char* LayerName, Hlong KernelSize, Hlong Dilation, Hlong Stride, Hlong NumKernel, Hlong Groups, const char* Padding, const char* Activation, const char* GenParamName, const char* GenParamValue) const;
  97. #ifdef _WIN32
  98. // Create a convolutional layer.
  99. HDlLayer CreateDlLayerConvolution(const wchar_t* LayerName, Hlong KernelSize, Hlong Dilation, Hlong Stride, Hlong NumKernel, Hlong Groups, const wchar_t* Padding, const wchar_t* Activation, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  100. #endif
  101. // Create a dense layer.
  102. HDlLayer CreateDlLayerDense(const HString& LayerName, Hlong NumOut, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  103. // Create a dense layer.
  104. HDlLayer CreateDlLayerDense(const HString& LayerName, Hlong NumOut, const HString& GenParamName, const HString& GenParamValue) const;
  105. // Create a dense layer.
  106. HDlLayer CreateDlLayerDense(const char* LayerName, Hlong NumOut, const char* GenParamName, const char* GenParamValue) const;
  107. #ifdef _WIN32
  108. // Create a dense layer.
  109. HDlLayer CreateDlLayerDense(const wchar_t* LayerName, Hlong NumOut, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  110. #endif
  111. // Create a depth max layer.
  112. HDlLayerArray CreateDlLayerDepthMax(const HString& LayerName, const HString& DepthMaxMode, const HTuple& GenParamName, const HTuple& GenParamValue, HDlLayerArray* DLLayerDepthMaxValue) const;
  113. // Create a depth max layer.
  114. HDlLayer CreateDlLayerDepthMax(const HString& LayerName, const HString& DepthMaxMode, const HString& GenParamName, const HString& GenParamValue, HDlLayer* DLLayerDepthMaxValue) const;
  115. // Create a depth max layer.
  116. HDlLayer CreateDlLayerDepthMax(const char* LayerName, const char* DepthMaxMode, const char* GenParamName, const char* GenParamValue, HDlLayer* DLLayerDepthMaxValue) const;
  117. #ifdef _WIN32
  118. // Create a depth max layer.
  119. HDlLayer CreateDlLayerDepthMax(const wchar_t* LayerName, const wchar_t* DepthMaxMode, const wchar_t* GenParamName, const wchar_t* GenParamValue, HDlLayer* DLLayerDepthMaxValue) const;
  120. #endif
  121. // Create a DropOut layer.
  122. HDlLayer CreateDlLayerDropout(const HString& LayerName, double Probability, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  123. // Create a DropOut layer.
  124. HDlLayer CreateDlLayerDropout(const HString& LayerName, double Probability, const HString& GenParamName, const HString& GenParamValue) const;
  125. // Create a DropOut layer.
  126. HDlLayer CreateDlLayerDropout(const char* LayerName, double Probability, const char* GenParamName, const char* GenParamValue) const;
  127. #ifdef _WIN32
  128. // Create a DropOut layer.
  129. HDlLayer CreateDlLayerDropout(const wchar_t* LayerName, double Probability, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  130. #endif
  131. // Create an elementwise layer.
  132. static HDlLayer CreateDlLayerElementwise(const HDlLayerArray& DLLayerInputs, const HString& LayerName, const HString& Operation, const HTuple& Coefficients, const HTuple& GenParamName, const HTuple& GenParamValue);
  133. // Create an elementwise layer.
  134. HDlLayer CreateDlLayerElementwise(const HString& LayerName, const HString& Operation, double Coefficients, const HString& GenParamName, const HString& GenParamValue) const;
  135. // Create an elementwise layer.
  136. HDlLayer CreateDlLayerElementwise(const char* LayerName, const char* Operation, double Coefficients, const char* GenParamName, const char* GenParamValue) const;
  137. #ifdef _WIN32
  138. // Create an elementwise layer.
  139. HDlLayer CreateDlLayerElementwise(const wchar_t* LayerName, const wchar_t* Operation, double Coefficients, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  140. #endif
  141. // Create an input layer.
  142. void CreateDlLayerInput(const HString& LayerName, const HTuple& Shape, const HTuple& GenParamName, const HTuple& GenParamValue);
  143. // Create an input layer.
  144. void CreateDlLayerInput(const HString& LayerName, const HTuple& Shape, const HString& GenParamName, const HString& GenParamValue);
  145. // Create an input layer.
  146. void CreateDlLayerInput(const char* LayerName, const HTuple& Shape, const char* GenParamName, const char* GenParamValue);
  147. #ifdef _WIN32
  148. // Create an input layer.
  149. void CreateDlLayerInput(const wchar_t* LayerName, const HTuple& Shape, const wchar_t* GenParamName, const wchar_t* GenParamValue);
  150. #endif
  151. // Create a cross entropy loss layer.
  152. HDlLayer CreateDlLayerLossCrossEntropy(const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const HString& LayerName, double LossWeight, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  153. // Create a cross entropy loss layer.
  154. HDlLayer CreateDlLayerLossCrossEntropy(const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const HString& LayerName, double LossWeight, const HString& GenParamName, const HString& GenParamValue) const;
  155. // Create a cross entropy loss layer.
  156. HDlLayer CreateDlLayerLossCrossEntropy(const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const char* LayerName, double LossWeight, const char* GenParamName, const char* GenParamValue) const;
  157. #ifdef _WIN32
  158. // Create a cross entropy loss layer.
  159. HDlLayer CreateDlLayerLossCrossEntropy(const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const wchar_t* LayerName, double LossWeight, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  160. #endif
  161. // Create a CTC loss layer.
  162. HDlLayer CreateDlLayerLossCtc(const HDlLayer& DLLayerInputLengths, const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerTargetLengths, const HString& LayerName, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  163. // Create a CTC loss layer.
  164. HDlLayer CreateDlLayerLossCtc(const HDlLayer& DLLayerInputLengths, const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerTargetLengths, const HString& LayerName, const HString& GenParamName, const HString& GenParamValue) const;
  165. // Create a CTC loss layer.
  166. HDlLayer CreateDlLayerLossCtc(const HDlLayer& DLLayerInputLengths, const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerTargetLengths, const char* LayerName, const char* GenParamName, const char* GenParamValue) const;
  167. #ifdef _WIN32
  168. // Create a CTC loss layer.
  169. HDlLayer CreateDlLayerLossCtc(const HDlLayer& DLLayerInputLengths, const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerTargetLengths, const wchar_t* LayerName, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  170. #endif
  171. // Create a distance loss layer.
  172. HDlLayer CreateDlLayerLossDistance(const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const HString& LayerName, const HString& DistanceType, double LossWeight, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  173. // Create a distance loss layer.
  174. HDlLayer CreateDlLayerLossDistance(const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const HString& LayerName, const HString& DistanceType, double LossWeight, const HString& GenParamName, const HString& GenParamValue) const;
  175. // Create a distance loss layer.
  176. HDlLayer CreateDlLayerLossDistance(const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const char* LayerName, const char* DistanceType, double LossWeight, const char* GenParamName, const char* GenParamValue) const;
  177. #ifdef _WIN32
  178. // Create a distance loss layer.
  179. HDlLayer CreateDlLayerLossDistance(const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const wchar_t* LayerName, const wchar_t* DistanceType, double LossWeight, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  180. #endif
  181. // Create a focal loss layer.
  182. HDlLayer CreateDlLayerLossFocal(const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const HDlLayer& DLLayerNormalization, const HString& LayerName, const HTuple& LossWeight, const HTuple& Gamma, const HTuple& ClassWeights, const HString& Type, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  183. // Create a focal loss layer.
  184. HDlLayer CreateDlLayerLossFocal(const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const HDlLayer& DLLayerNormalization, const HString& LayerName, double LossWeight, double Gamma, double ClassWeights, const HString& Type, const HString& GenParamName, const HString& GenParamValue) const;
  185. // Create a focal loss layer.
  186. HDlLayer CreateDlLayerLossFocal(const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const HDlLayer& DLLayerNormalization, const char* LayerName, double LossWeight, double Gamma, double ClassWeights, const char* Type, const char* GenParamName, const char* GenParamValue) const;
  187. #ifdef _WIN32
  188. // Create a focal loss layer.
  189. HDlLayer CreateDlLayerLossFocal(const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const HDlLayer& DLLayerNormalization, const wchar_t* LayerName, double LossWeight, double Gamma, double ClassWeights, const wchar_t* Type, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  190. #endif
  191. // Create a Huber loss layer.
  192. HDlLayer CreateDlLayerLossHuber(const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const HDlLayer& DLLayerNormalization, const HString& LayerName, double LossWeight, double Beta, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  193. // Create a Huber loss layer.
  194. HDlLayer CreateDlLayerLossHuber(const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const HDlLayer& DLLayerNormalization, const HString& LayerName, double LossWeight, double Beta, const HString& GenParamName, const HString& GenParamValue) const;
  195. // Create a Huber loss layer.
  196. HDlLayer CreateDlLayerLossHuber(const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const HDlLayer& DLLayerNormalization, const char* LayerName, double LossWeight, double Beta, const char* GenParamName, const char* GenParamValue) const;
  197. #ifdef _WIN32
  198. // Create a Huber loss layer.
  199. HDlLayer CreateDlLayerLossHuber(const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const HDlLayer& DLLayerNormalization, const wchar_t* LayerName, double LossWeight, double Beta, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  200. #endif
  201. // Create a LRN layer.
  202. HDlLayer CreateDlLayerLrn(const HString& LayerName, Hlong LocalSize, double Alpha, double Beta, double K, const HString& NormRegion, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  203. // Create a LRN layer.
  204. HDlLayer CreateDlLayerLrn(const HString& LayerName, Hlong LocalSize, double Alpha, double Beta, double K, const HString& NormRegion, const HString& GenParamName, const HString& GenParamValue) const;
  205. // Create a LRN layer.
  206. HDlLayer CreateDlLayerLrn(const char* LayerName, Hlong LocalSize, double Alpha, double Beta, double K, const char* NormRegion, const char* GenParamName, const char* GenParamValue) const;
  207. #ifdef _WIN32
  208. // Create a LRN layer.
  209. HDlLayer CreateDlLayerLrn(const wchar_t* LayerName, Hlong LocalSize, double Alpha, double Beta, double K, const wchar_t* NormRegion, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  210. #endif
  211. // Create a pooling layer.
  212. HDlLayer CreateDlLayerPooling(const HString& LayerName, const HTuple& KernelSize, const HTuple& Stride, const HTuple& Padding, const HString& Mode, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  213. // Create a pooling layer.
  214. HDlLayer CreateDlLayerPooling(const HString& LayerName, const HTuple& KernelSize, const HTuple& Stride, const HString& Padding, const HString& Mode, const HString& GenParamName, const HString& GenParamValue) const;
  215. // Create a pooling layer.
  216. HDlLayer CreateDlLayerPooling(const char* LayerName, const HTuple& KernelSize, const HTuple& Stride, const char* Padding, const char* Mode, const char* GenParamName, const char* GenParamValue) const;
  217. #ifdef _WIN32
  218. // Create a pooling layer.
  219. HDlLayer CreateDlLayerPooling(const wchar_t* LayerName, const HTuple& KernelSize, const HTuple& Stride, const wchar_t* Padding, const wchar_t* Mode, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  220. #endif
  221. // Create a reshape layer.
  222. HDlLayer CreateDlLayerReshape(const HString& LayerName, const HTuple& Shape, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  223. // Create a reshape layer.
  224. HDlLayer CreateDlLayerReshape(const HString& LayerName, const HTuple& Shape, const HString& GenParamName, const HString& GenParamValue) const;
  225. // Create a reshape layer.
  226. HDlLayer CreateDlLayerReshape(const char* LayerName, const HTuple& Shape, const char* GenParamName, const char* GenParamValue) const;
  227. #ifdef _WIN32
  228. // Create a reshape layer.
  229. HDlLayer CreateDlLayerReshape(const wchar_t* LayerName, const HTuple& Shape, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  230. #endif
  231. // Create a softmax layer.
  232. HDlLayer CreateDlLayerSoftmax(const HString& LayerName, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  233. // Create a softmax layer.
  234. HDlLayer CreateDlLayerSoftmax(const HString& LayerName, const HString& GenParamName, const HString& GenParamValue) const;
  235. // Create a softmax layer.
  236. HDlLayer CreateDlLayerSoftmax(const char* LayerName, const char* GenParamName, const char* GenParamValue) const;
  237. #ifdef _WIN32
  238. // Create a softmax layer.
  239. HDlLayer CreateDlLayerSoftmax(const wchar_t* LayerName, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  240. #endif
  241. // Create a transposed convolution layer.
  242. HDlLayer CreateDlLayerTransposedConvolution(const HString& LayerName, Hlong KernelSize, Hlong Stride, Hlong KernelDepth, Hlong Groups, const HTuple& Padding, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  243. // Create a transposed convolution layer.
  244. HDlLayer CreateDlLayerTransposedConvolution(const HString& LayerName, Hlong KernelSize, Hlong Stride, Hlong KernelDepth, Hlong Groups, const HString& Padding, const HString& GenParamName, const HString& GenParamValue) const;
  245. // Create a transposed convolution layer.
  246. HDlLayer CreateDlLayerTransposedConvolution(const char* LayerName, Hlong KernelSize, Hlong Stride, Hlong KernelDepth, Hlong Groups, const char* Padding, const char* GenParamName, const char* GenParamValue) const;
  247. #ifdef _WIN32
  248. // Create a transposed convolution layer.
  249. HDlLayer CreateDlLayerTransposedConvolution(const wchar_t* LayerName, Hlong KernelSize, Hlong Stride, Hlong KernelDepth, Hlong Groups, const wchar_t* Padding, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  250. #endif
  251. // Create a zoom layer using size factors.
  252. HDlLayer CreateDlLayerZoomFactor(const HString& LayerName, const HTuple& ScaleWidth, const HTuple& ScaleHeight, const HString& Interpolation, const HString& AlignCorners, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  253. // Create a zoom layer using size factors.
  254. HDlLayer CreateDlLayerZoomFactor(const HString& LayerName, double ScaleWidth, double ScaleHeight, const HString& Interpolation, const HString& AlignCorners, const HString& GenParamName, const HString& GenParamValue) const;
  255. // Create a zoom layer using size factors.
  256. HDlLayer CreateDlLayerZoomFactor(const char* LayerName, double ScaleWidth, double ScaleHeight, const char* Interpolation, const char* AlignCorners, const char* GenParamName, const char* GenParamValue) const;
  257. #ifdef _WIN32
  258. // Create a zoom layer using size factors.
  259. HDlLayer CreateDlLayerZoomFactor(const wchar_t* LayerName, double ScaleWidth, double ScaleHeight, const wchar_t* Interpolation, const wchar_t* AlignCorners, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  260. #endif
  261. // Create a zoom layer using an absolute output size.
  262. HDlLayer CreateDlLayerZoomSize(const HString& LayerName, Hlong Width, Hlong Height, const HString& Interpolation, const HString& AlignCorners, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  263. // Create a zoom layer using an absolute output size.
  264. HDlLayer CreateDlLayerZoomSize(const HString& LayerName, Hlong Width, Hlong Height, const HString& Interpolation, const HString& AlignCorners, const HString& GenParamName, const HString& GenParamValue) const;
  265. // Create a zoom layer using an absolute output size.
  266. HDlLayer CreateDlLayerZoomSize(const char* LayerName, Hlong Width, Hlong Height, const char* Interpolation, const char* AlignCorners, const char* GenParamName, const char* GenParamValue) const;
  267. #ifdef _WIN32
  268. // Create a zoom layer using an absolute output size.
  269. HDlLayer CreateDlLayerZoomSize(const wchar_t* LayerName, Hlong Width, Hlong Height, const wchar_t* Interpolation, const wchar_t* AlignCorners, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  270. #endif
  271. // Create a zoom layer using the output size of a reference layer.
  272. HDlLayer CreateDlLayerZoomToLayerSize(const HDlLayer& DLLayerReference, const HString& LayerName, const HString& Interpolation, const HString& AlignCorners, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  273. // Create a zoom layer using the output size of a reference layer.
  274. HDlLayer CreateDlLayerZoomToLayerSize(const HDlLayer& DLLayerReference, const HString& LayerName, const HString& Interpolation, const HString& AlignCorners, const HString& GenParamName, const HString& GenParamValue) const;
  275. // Create a zoom layer using the output size of a reference layer.
  276. HDlLayer CreateDlLayerZoomToLayerSize(const HDlLayer& DLLayerReference, const char* LayerName, const char* Interpolation, const char* AlignCorners, const char* GenParamName, const char* GenParamValue) const;
  277. #ifdef _WIN32
  278. // Create a zoom layer using the output size of a reference layer.
  279. HDlLayer CreateDlLayerZoomToLayerSize(const HDlLayer& DLLayerReference, const wchar_t* LayerName, const wchar_t* Interpolation, const wchar_t* AlignCorners, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  280. #endif
  281. // Return the parameters of a deep learning layer.
  282. HTuple GetDlLayerParam(const HString& GenParamName) const;
  283. // Return the parameters of a deep learning layer.
  284. HTuple GetDlLayerParam(const char* GenParamName) const;
  285. #ifdef _WIN32
  286. // Return the parameters of a deep learning layer.
  287. HTuple GetDlLayerParam(const wchar_t* GenParamName) const;
  288. #endif
  289. // Create a deep copy of the layers and all of their graph ancestors in a given deep learning model.
  290. static HDlLayerArray GetDlModelLayer(const HDlModel& DLModelHandle, const HTuple& LayerNames);
  291. // Create a deep copy of the layers and all of their graph ancestors in a given deep learning model.
  292. void GetDlModelLayer(const HDlModel& DLModelHandle, const HString& LayerNames);
  293. // Create a deep copy of the layers and all of their graph ancestors in a given deep learning model.
  294. void GetDlModelLayer(const HDlModel& DLModelHandle, const char* LayerNames);
  295. #ifdef _WIN32
  296. // Create a deep copy of the layers and all of their graph ancestors in a given deep learning model.
  297. void GetDlModelLayer(const HDlModel& DLModelHandle, const wchar_t* LayerNames);
  298. #endif
  299. // Retrieve parameter values for a given layer.
  300. static HTuple GetDlModelLayerParam(const HDlModel& DLModelHandle, const HString& LayerName, const HString& ParamName);
  301. // Retrieve parameter values for a given layer.
  302. static HTuple GetDlModelLayerParam(const HDlModel& DLModelHandle, const char* LayerName, const char* ParamName);
  303. #ifdef _WIN32
  304. // Retrieve parameter values for a given layer.
  305. static HTuple GetDlModelLayerParam(const HDlModel& DLModelHandle, const wchar_t* LayerName, const wchar_t* ParamName);
  306. #endif
  307. // Set parameter values of a given layer.
  308. static void SetDlModelLayerParam(const HDlModel& DLModelHandle, const HString& LayerName, const HString& ParamName, const HTuple& ParamValue);
  309. // Set parameter values of a given layer.
  310. static void SetDlModelLayerParam(const HDlModel& DLModelHandle, const HString& LayerName, const HString& ParamName, const HString& ParamValue);
  311. // Set parameter values of a given layer.
  312. static void SetDlModelLayerParam(const HDlModel& DLModelHandle, const char* LayerName, const char* ParamName, const char* ParamValue);
  313. #ifdef _WIN32
  314. // Set parameter values of a given layer.
  315. static void SetDlModelLayerParam(const HDlModel& DLModelHandle, const wchar_t* LayerName, const wchar_t* ParamName, const wchar_t* ParamValue);
  316. #endif
  317. // Create a permutation layer.
  318. HDlLayer CreateDlLayerPermutation(const HString& LayerName, const HTuple& Permutation, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  319. // Create a permutation layer.
  320. HDlLayer CreateDlLayerPermutation(const HString& LayerName, const HTuple& Permutation, const HString& GenParamName, const HString& GenParamValue) const;
  321. // Create a permutation layer.
  322. HDlLayer CreateDlLayerPermutation(const char* LayerName, const HTuple& Permutation, const char* GenParamName, const char* GenParamValue) const;
  323. #ifdef _WIN32
  324. // Create a permutation layer.
  325. HDlLayer CreateDlLayerPermutation(const wchar_t* LayerName, const HTuple& Permutation, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  326. #endif
  327. };
  328. // forward declarations and types for internal array implementation
  329. template<class T> class HSmartPtr;
  330. template<class T> class HHandleBaseArrayRef;
  331. typedef HHandleBaseArrayRef<HDlLayer> HDlLayerArrayRef;
  332. typedef HSmartPtr< HDlLayerArrayRef > HDlLayerArrayPtr;
  333. // Represents multiple tool instances
  334. class LIntExport HDlLayerArray : public HHandleBaseArray
  335. {
  336. public:
  337. // Create empty array
  338. HDlLayerArray();
  339. // Create array from native array of tool instances
  340. HDlLayerArray(const HDlLayer* classes, Hlong length);
  341. // Copy constructor
  342. HDlLayerArray(const HDlLayerArray &tool_array);
  343. // Destructor
  344. virtual ~HDlLayerArray();
  345. // Assignment operator
  346. HDlLayerArray &operator=(const HDlLayerArray &tool_array);
  347. // Clears array and all tool instances
  348. virtual void Clear();
  349. // Get array of native tool instances
  350. const HDlLayer* Tools() const;
  351. // Get number of tools
  352. virtual Hlong Length() const;
  353. // Create tool array from tuple of handles
  354. virtual void SetFromTuple(const HTuple& handles);
  355. // Get tuple of handles for tool array
  356. virtual HTuple ConvertToTuple() const;
  357. protected:
  358. // Smart pointer to internal data container
  359. HDlLayerArrayPtr *mArrayPtr;
  360. };
  361. }
  362. #endif