You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

operators.md 72 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922
  1. * [AbsVal](#absval)
  2. * [ArgMax](#argmax)
  3. * [BatchNorm](#batchnorm)
  4. * [Bias](#bias)
  5. * [BinaryOp](#binaryop)
  6. * [BNLL](#bnll)
  7. * [Cast](#cast)
  8. * [CELU](#celu)
  9. * [Clip](#clip)
  10. * [Concat](#concat)
  11. * [Convolution](#convolution)
  12. * [Convolution1D](#convolution1d)
  13. * [Convolution3D](#convolution3d)
  14. * [ConvolutionDepthWise](#convolutiondepthwise)
  15. * [ConvolutionDepthWise1D](#convolutiondepthwise1d)
  16. * [ConvolutionDepthWise3D](#convolutiondepthwise3d)
  17. * [CopyTo](#copyto)
  18. * [Crop](#crop)
  19. * [CumulativeSum](#cumulativesum)
  20. * [Deconvolution](#deconvolution)
  21. * [Deconvolution1D](#deconvolution1d)
  22. * [Deconvolution3D](#deconvolution3d)
  23. * [DeconvolutionDepthWise](#deconvolutiondepthwise)
  24. * [DeconvolutionDepthWise1D](#deconvolutiondepthwise1d)
  25. * [DeconvolutionDepthWise3D](#deconvolutiondepthwise3d)
  26. * [DeformableConv2D](#deformableconv2d)
  27. * [Dequantize](#dequantize)
  28. * [Diag](#diag)
  29. * [Dropout](#dropout)
  30. * [Eltwise](#eltwise)
  31. * [ELU](#elu)
  32. * [Embed](#embed)
  33. * [Exp](#exp)
  34. * [Flatten](#flatten)
  35. * [Fold](#fold)
  36. * [GELU](#gelu)
  37. * [GLU](#glu)
  38. * [Gemm](#gemm)
  39. * [GridSample](#gridsample)
  40. * [GroupNorm](#groupnorm)
  41. * [GRU](#gru)
  42. * [HardSigmoid](#hardsigmoid)
  43. * [HardSwish](#hardswish)
  44. * [InnerProduct](#innerproduct)
  45. * [Input](#input)
  46. * [InstanceNorm](#instancenorm)
  47. * [Interp](#interp)
  48. * [LayerNorm](#layernorm)
  49. * [Log](#log)
  50. * [LRN](#lrn)
  51. * [LSTM](#lstm)
  52. * [MemoryData](#memorydata)
  53. * [Mish](#mish)
  54. * [MultiHeadAttention](#multiheadattention)
  55. * [MVN](#mvn)
  56. * [Noop](#noop)
  57. * [Normalize](#normalize)
  58. * [Packing](#packing)
  59. * [Padding](#padding)
  60. * [Permute](#permute)
  61. * [PixelShuffle](#pixelshuffle)
  62. * [Pooling](#pooling)
  63. * [Pooling1D](#pooling1d)
  64. * [Pooling3D](#pooling3d)
  65. * [Power](#power)
  66. * [PReLU](#prelu)
  67. * [Quantize](#quantize)
  68. * [Reduction](#reduction)
  69. * [ReLU](#relu)
  70. * [Reorg](#reorg)
  71. * [Requantize](#requantize)
  72. * [Reshape](#reshape)
  73. * [RMSNorm](#rmsnorm)
  74. * [RNN](#rnn)
  75. * [Scale](#scale)
  76. * [SELU](#selu)
  77. * [Shrink](#shrink)
  78. * [ShuffleChannel](#shufflechannel)
  79. * [Sigmoid](#sigmoid)
  80. * [Slice](#slice)
  81. * [Softmax](#softmax)
  82. * [Softplus](#softplus)
  83. * [Split](#split)
  84. * [Swish](#swish)
  85. * [TanH](#tanh)
  86. * [Threshold](#threshold)
  87. * [Tile](#tile)
  88. * [UnaryOp](#unaryop)
  89. * [Unfold](#unfold)
  90. # AbsVal
  91. ```
  92. y = abs(x)
  93. ```
  94. * one_blob_only
  95. * support_inplace
  96. # ArgMax
  97. ```
  98. y = argmax(x, out_max_val, topk)
  99. ```
  100. * one_blob_only
  101. | param id | name | type | default | description |
  102. | --------- | ------------- | ----- | --------- | ----------------- |
  103. | 0 | out_max_val | int | 0 | |
  104. | 1 | topk | int | 1 | |
  105. # BatchNorm
  106. ```
  107. y = (x - mean) / sqrt(var + eps) * slope + bias
  108. ```
  109. * one_blob_only
  110. * support_inplace
  111. | param id | name | type | default | description |
  112. | --------- | ------------- | ----- | --------- | ----------------- |
  113. | 0 | channels | int | 0 | |
  114. | 1 | eps | float | 0.f | |
  115. | weight | type | shape |
  116. | ------------- | ----- | --------------------- |
  117. | slope_data | float | [channels] |
  118. | mean_data | float | [channels] |
  119. | var_data | float | [channels] |
  120. | bias_data | float | [channels] |
  121. # Bias
  122. ```
  123. y = x + bias
  124. ```
  125. * one_blob_only
  126. * support_inplace
  127. | param id | name | type | default | description |
  128. | --------- | ------------- | ----- | --------- | ----------------- |
  129. | 0 | bias_data_size| int | 0 | |
  130. | weight | type | shape |
  131. | ------------- | ----- | --------------------- |
  132. | bias_data | float | [channels] |
  133. # BinaryOp
  134. This operation is used for binary computation, and the calculation rule depends on the [broadcasting rule](https://github.com/Tencent/ncnn/wiki/binaryop-broadcasting).
  135. ```
  136. C = binaryop(A, B)
  137. ```
  138. if with_scalar = 1:
  139. - one_blob_only
  140. - support_inplace
  141. | param id | name | type | default | description |
  142. | --------- | ------------- | ----- | --------- | ----------------- |
  143. | 0 | op_type | int | 0 | Operation type as follows |
  144. | 1 | with_scalar | int | 0 | with_scalar=0 B is a matrix, with_scalar=1 B is a scalar |
  145. | 2 | b | float | 0.f | When B is a scalar, B = b |
  146. Operation type:
  147. - 0 = ADD
  148. - 1 = SUB
  149. - 2 = MUL
  150. - 3 = DIV
  151. - 4 = MAX
  152. - 5 = MIN
  153. - 6 = POW
  154. - 7 = RSUB
  155. - 8 = RDIV
  156. - 9 = RPOW
  157. - 10 = ATAN2
  158. - 11 = RATAN2
  159. # BNLL
  160. ```
  161. y = log(1 + e^(-x)) , x > 0
  162. y = log(1 + e^x), x < 0
  163. ```
  164. * one_blob_only
  165. * support_inplace
  166. # Cast
  167. ```
  168. y = cast(x)
  169. ```
  170. * one_blob_only
  171. * support_packing
  172. | param id | name | type | default | description |
  173. | --------- | ------------- | ----- | --------- | ----------------- |
  174. | 0 | type_from | int | 0 | |
  175. | 1 | type_to | int | 0 | |
  176. Element type:
  177. - 0 = auto
  178. - 1 = float32
  179. - 2 = float16
  180. - 3 = int8
  181. - 4 = bfloat16
  182. # CELU
  183. ```
  184. if x < 0 y = (exp(x / alpha) - 1.f) * alpha
  185. else y = x
  186. ```
  187. * one_blob_only
  188. * support_inplace
  189. | param id | name | type | default | description |
  190. | --------- | ------------- | ----- | --------- | ----------------- |
  191. | 0 | alpha | float | 1.f | |
  192. # Clip
  193. ```
  194. y = clamp(x, min, max)
  195. ```
  196. * one_blob_only
  197. * support_inplace
  198. | param id | name | type | default | description |
  199. | --------- | ------------- | ----- | --------- | ----------------- |
  200. | 0 | min | float | -FLT_MAX | |
  201. | 1 | max | float | FLT_MAX | |
  202. # Concat
  203. ```
  204. y = concat(x0, x1, x2, ...) by axis
  205. ```
  206. | param id | name | type | default | description |
  207. | --------- | ------------- | ----- | --------- | ----------------- |
  208. | 0 | axis | int | 0 | |
  209. # Convolution
  210. ```
  211. x2 = pad(x, pads, pad_value)
  212. x3 = conv(x2, weight, kernel, stride, dilation) + bias
  213. y = activation(x3, act_type, act_params)
  214. ```
  215. * one_blob_only
  216. | param id | name | type | default | description |
  217. | --------- | ------------- | ----- | --------- | ----------------- |
  218. | 0 | num_output | int | 0 | |
  219. | 1 | kernel_w | int | 0 | |
  220. | 2 | dilation_w | int | 1 | |
  221. | 3 | stride_w | int | 1 | |
  222. | 4 | pad_left | int | 0 | |
  223. | 5 | bias_term | int | 0 | |
  224. | 6 | weight_data_size| int | 0 | |
  225. | 8 | int8_scale_term| int | 0 | |
  226. | 9 | activation_type| int | 0 | |
  227. | 10 | activation_params| array | [ ] | |
  228. | 11 | kernel_h | int | kernel_w | |
  229. | 12 | dilation_h | int | dilation_w | |
  230. | 13 | stride_h | int | stride_w | |
  231. | 14 | pad_top | int | pad_left | |
  232. | 15 | pad_right | int | pad_left | |
  233. | 16 | pad_bottom | int | pad_top | |
  234. | 18 | pad_value | float | 0.f | |
  235. | 19 | dynamic_weight| int | 0 | |
  236. | weight | type | shape |
  237. | ------------- | ----- | --------------------- |
  238. | weight_data | float/fp16/int8 | [kernel_w, kernel_h, num_input, num_output] |
  239. | bias_data | float | [num_output] |
  240. | weight_data_int8_scales| float | [num_output] |
  241. | bottom_blob_int8_scales| float | [1] |
  242. | top_blob_int8_scales| float | [1] |
  243. # Convolution1D
  244. ```
  245. x2 = pad(x, pads, pad_value)
  246. x3 = conv1d(x2, weight, kernel, stride, dilation) + bias
  247. y = activation(x3, act_type, act_params)
  248. ```
  249. * one_blob_only
  250. | param id | name | type | default | description |
  251. | --------- | ------------- | ----- | --------- | ----------------- |
  252. | 0 | num_output | int | 0 | |
  253. | 1 | kernel_w | int | 0 | |
  254. | 2 | dilation_w | int | 1 | |
  255. | 3 | stride_w | int | 1 | |
  256. | 4 | pad_left | int | 0 | |
  257. | 5 | bias_term | int | 0 | |
  258. | 6 | weight_data_size| int | 0 | |
  259. | 9 | activation_type| int | 0 | |
  260. | 10 | activation_params| array | [ ] | |
  261. | 15 | pad_right | int | pad_left | |
  262. | 18 | pad_value | float | 0.f | |
  263. | 19 | dynamic_weight| int | 0 | |
  264. | weight | type | shape |
  265. | ------------- | ----- | --------------------- |
  266. | weight_data | float/fp16/int8 | [kernel_w, num_input, num_output] |
  267. | bias_data | float | [num_output] |
  268. # Convolution3D
  269. ```
  270. x2 = pad(x, pads, pad_value)
  271. x3 = conv3d(x2, weight, kernel, stride, dilation) + bias
  272. y = activation(x3, act_type, act_params)
  273. ```
  274. * one_blob_only
  275. | param id | name | type | default | description |
  276. | --------- | ------------- | ----- | --------- | ----------------- |
  277. | 0 | num_output | int | 0 | |
  278. | 1 | kernel_w | int | 0 | |
  279. | 2 | dilation_w | int | 1 | |
  280. | 3 | stride_w | int | 1 | |
  281. | 4 | pad_left | int | 0 | |
  282. | 5 | bias_term | int | 0 | |
  283. | 6 | weight_data_size| int | 0 | |
  284. | 9 | activation_type| int | 0 | |
  285. | 10 | activation_params| array | [ ] | |
  286. | 11 | kernel_h | int | kernel_w | |
  287. | 12 | dilation_h | int | dilation_w | |
  288. | 13 | stride_h | int | stride_w | |
  289. | 14 | pad_top | int | pad_left | |
  290. | 15 | pad_right | int | pad_left | |
  291. | 16 | pad_bottom | int | pad_top | |
  292. | 17 | pad_behind | int | pad_front | |
  293. | 18 | pad_value | float | 0.f | |
  294. | 21 | kernel_d | int | kernel_w | |
  295. | 22 | dilation_d | int | dilation_w | |
  296. | 23 | stride_d | int | stride_w | |
  297. | 24 | pad_front | int | pad_left | |
  298. | weight | type | shape |
  299. | ------------- | ----- | --------------------- |
  300. | weight_data | float/fp16/int8 | [kernel_w, kernel_h, kernel_d, num_input, num_output] |
  301. | bias_data | float | [num_output] |
  302. # ConvolutionDepthWise
  303. ```
  304. x2 = pad(x, pads, pad_value)
  305. x3 = conv(x2, weight, kernel, stride, dilation, group) + bias
  306. y = activation(x3, act_type, act_params)
  307. ```
  308. * one_blob_only
  309. | param id | name | type | default | description |
  310. | --------- | ------------- | ----- | --------- | ----------------- |
  311. | 0 | num_output | int | 0 | |
  312. | 1 | kernel_w | int | 0 | |
  313. | 2 | dilation_w | int | 1 | |
  314. | 3 | stride_w | int | 1 | |
  315. | 4 | pad_left | int | 0 | |
  316. | 5 | bias_term | int | 0 | |
  317. | 6 | weight_data_size| int | 0 | |
  318. | 7 | group | int | 1 | |
  319. | 8 | int8_scale_term| int | 0 | |
  320. | 9 | activation_type| int | 0 | |
  321. | 10 | activation_params| array | [ ] | |
  322. | 11 | kernel_h | int | kernel_w | |
  323. | 12 | dilation_h | int | dilation_w | |
  324. | 13 | stride_h | int | stride_w | |
  325. | 14 | pad_top | int | pad_left | |
  326. | 15 | pad_right | int | pad_left | |
  327. | 16 | pad_bottom | int | pad_top | |
  328. | 18 | pad_value | float | 0.f | |
  329. | 19 | dynamic_weight| int | 0 | |
  330. | weight | type | shape |
  331. | ------------- | ----- | --------------------- |
  332. | weight_data | float/fp16/int8 | [kernel_w, kernel_h, num_input / group, num_output / group, group] |
  333. | bias_data | float | [num_output] |
  334. | weight_data_int8_scales| float | [group] |
  335. | bottom_blob_int8_scales| float | [1] |
  336. | top_blob_int8_scales| float | [1] |
  337. # ConvolutionDepthWise1D
  338. ```
  339. x2 = pad(x, pads, pad_value)
  340. x3 = conv1d(x2, weight, kernel, stride, dilation, group) + bias
  341. y = activation(x3, act_type, act_params)
  342. ```
  343. * one_blob_only
  344. | param id | name | type | default | description |
  345. | --------- | ------------- | ----- | --------- | ----------------- |
  346. | 0 | num_output | int | 0 | |
  347. | 1 | kernel_w | int | 0 | |
  348. | 2 | dilation_w | int | 1 | |
  349. | 3 | stride_w | int | 1 | |
  350. | 4 | pad_left | int | 0 | |
  351. | 5 | bias_term | int | 0 | |
  352. | 6 | weight_data_size| int | 0 | |
  353. | 7 | group | int | 1 | |
  354. | 9 | activation_type| int | 0 | |
  355. | 10 | activation_params| array | [ ] | |
  356. | 15 | pad_right | int | pad_left | |
  357. | 18 | pad_value | float | 0.f | |
  358. | 19 | dynamic_weight| int | 0 | |
  359. | weight | type | shape |
  360. | ------------- | ----- | --------------------- |
  361. | weight_data | float/fp16/int8 | [kernel_w, num_input / group, num_output / group, group] |
  362. | bias_data | float | [num_output] |
  363. # ConvolutionDepthWise3D
  364. ```
  365. x2 = pad(x, pads, pad_value)
  366. x3 = conv3d(x2, weight, kernel, stride, dilation, group) + bias
  367. y = activation(x3, act_type, act_params)
  368. ```
  369. * one_blob_only
  370. | param id | name | type | default | description |
  371. | --------- | ------------- | ----- | --------- | ----------------- |
  372. | 0 | num_output | int | 0 | |
  373. | 1 | kernel_w | int | 0 | |
  374. | 2 | dilation_w | int | 1 | |
  375. | 3 | stride_w | int | 1 | |
  376. | 4 | pad_left | int | 0 | |
  377. | 5 | bias_term | int | 0 | |
  378. | 6 | weight_data_size| int | 0 | |
  379. | 7 | group | int | 1 | |
  380. | 9 | activation_type| int | 0 | |
  381. | 10 | activation_params| array | [ ] | |
  382. | 11 | kernel_h | int | kernel_w | |
  383. | 12 | dilation_h | int | dilation_w | |
  384. | 13 | stride_h | int | stride_w | |
  385. | 14 | pad_top | int | pad_left | |
  386. | 15 | pad_right | int | pad_left | |
  387. | 16 | pad_bottom | int | pad_top | |
  388. | 17 | pad_behind | int | pad_front | |
  389. | 18 | pad_value | float | 0.f | |
  390. | 21 | kernel_d | int | kernel_w | |
  391. | 22 | dilation_d | int | dilation_w | |
  392. | 23 | stride_d | int | stride_w | |
  393. | 24 | pad_front | int | pad_left | |
  394. | weight | type | shape |
  395. | ------------- | ----- | --------------------- |
  396. | weight_data | float/fp16/int8 | [kernel_w, kernel_h, kernel_d, num_input / group, num_output / group, group] |
  397. | bias_data | float | [num_output] |
  398. # CopyTo
  399. ```
  400. self[offset] = src
  401. ```
  402. * one_blob_only
  403. | param id | name | type | default | description |
  404. | --------- | ------------- | ----- | --------- | ----------------- |
  405. | 0 | woffset | int | 0 | |
  406. | 1 | hoffset | int | 0 | |
  407. | 13 | doffset | int | 0 | |
  408. | 2 | coffset | int | 0 | |
  409. | 9 | starts | array | [ ] | |
  410. | 11 | axes | array | [ ] | |
  411. # Crop
  412. ```
  413. y = crop(x)
  414. ```
  415. * one_blob_only
  416. | param id | name | type | default | description |
  417. | --------- | ------------- | ----- | --------- | ----------------- |
  418. | 0 | woffset | int | 0 | |
  419. | 1 | hoffset | int | 0 | |
  420. | 13 | doffset | int | 0 | |
  421. | 2 | coffset | int | 0 | |
  422. | 3 | outw | int | 0 | |
  423. | 4 | outh | int | 0 | |
  424. | 14 | outd | int | 0 | |
  425. | 5 | outc | int | 0 | |
  426. | 6 | woffset2 | int | 0 | |
  427. | 7 | hoffset2 | int | 0 | |
  428. | 15 | doffset2 | int | 0 | |
  429. | 8 | coffset2 | int | 0 | |
  430. | 9 | starts | array | [ ] | |
  431. | 10 | ends | array | [ ] | |
  432. | 11 | axes | array | [ ] | |
  433. # CumulativeSum
  434. If axis < 0, we use axis = x.dims + axis
  435. It implements https://pytorch.org/docs/stable/generated/torch.cumsum.html
  436. * one_blob_only
  437. * support_inplace
  438. | param id | name | type | default | description |
  439. | --------- | ------------- | ----- | --------- | ----------------- |
  440. | 0 | axis | int | 0 | |
  441. # Deconvolution
  442. ```
  443. x2 = deconv(x, weight, kernel, stride, dilation) + bias
  444. x3 = depad(x2, pads, pad_value)
  445. y = activation(x3, act_type, act_params)
  446. ```
  447. * one_blob_only
  448. | param id | name | type | default | description |
  449. | --------- | ------------- | ----- | --------- | ----------------- |
  450. | 0 | num_output | int | 0 | |
  451. | 1 | kernel_w | int | 0 | |
  452. | 2 | dilation_w | int | 1 | |
  453. | 3 | stride_w | int | 1 | |
  454. | 4 | pad_left | int | 0 | |
  455. | 5 | bias_term | int | 0 | |
  456. | 6 | weight_data_size| int | 0 | |
  457. | 9 | activation_type| int | 0 | |
  458. | 10 | activation_params| array | [ ] | |
  459. | 11 | kernel_h | int | kernel_w | |
  460. | 12 | dilation_h | int | dilation_w | |
  461. | 13 | stride_h | int | stride_w | |
  462. | 14 | pad_top | int | pad_left | |
  463. | 15 | pad_right | int | pad_left | |
  464. | 16 | pad_bottom | int | pad_top | |
  465. | 18 | output_pad_right| int | 0 | |
  466. | 19 | output_pad_bottom| int | output_pad_right | |
  467. | 20 | output_w | int | 0 | |
  468. | 21 | output_h | int | output_w | |
  469. | 28 | dynamic_weight| int | 0 | |
  470. | weight | type | shape |
  471. | ------------- | ----- | --------------------- |
  472. | weight_data | float/fp16 | [kernel_w, kernel_h, num_input, num_output] |
  473. | bias_data | float | [num_output] |
  474. # Deconvolution1D
  475. ```
  476. x2 = deconv1d(x, weight, kernel, stride, dilation) + bias
  477. x3 = depad(x2, pads, pad_value)
  478. y = activation(x3, act_type, act_params)
  479. ```
  480. * one_blob_only
  481. | param id | name | type | default | description |
  482. | --------- | ------------- | ----- | --------- | ----------------- |
  483. | 0 | num_output | int | 0 | |
  484. | 1 | kernel_w | int | 0 | |
  485. | 2 | dilation_w | int | 1 | |
  486. | 3 | stride_w | int | 1 | |
  487. | 4 | pad_left | int | 0 | |
  488. | 5 | bias_term | int | 0 | |
  489. | 6 | weight_data_size| int | 0 | |
  490. | 9 | activation_type| int | 0 | |
  491. | 10 | activation_params| array | [ ] | |
  492. | 15 | pad_right | int | pad_left | |
  493. | 18 | output_pad_right| int | 0 | |
  494. | 20 | output_w | int | 0 | |
  495. | 28 | dynamic_weight| int | 0 | |
  496. | weight | type | shape |
  497. | ------------- | ----- | --------------------- |
  498. | weight_data | float/fp16 | [kernel_w, num_input, num_output] |
  499. | bias_data | float | [num_output] |
  500. # Deconvolution3D
  501. ```
  502. x2 = deconv3d(x, weight, kernel, stride, dilation) + bias
  503. x3 = depad(x2, pads, pad_value)
  504. y = activation(x3, act_type, act_params)
  505. ```
  506. * one_blob_only
  507. | param id | name | type | default | description |
  508. | --------- | ------------- | ----- | --------- | ----------------- |
  509. | 0 | num_output | int | 0 | |
  510. | 1 | kernel_w | int | 0 | |
  511. | 2 | dilation_w | int | 1 | |
  512. | 3 | stride_w | int | 1 | |
  513. | 4 | pad_left | int | 0 | |
  514. | 5 | bias_term | int | 0 | |
  515. | 6 | weight_data_size| int | 0 | |
  516. | 9 | activation_type| int | 0 | |
  517. | 10 | activation_params| array | [ ] | |
  518. | 11 | kernel_h | int | kernel_w | |
  519. | 12 | dilation_h | int | dilation_w | |
  520. | 13 | stride_h | int | stride_w | |
  521. | 14 | pad_top | int | pad_left | |
  522. | 15 | pad_right | int | pad_left | |
  523. | 16 | pad_bottom | int | pad_top | |
  524. | 17 | pad_behind | int | pad_front | |
  525. | 18 | output_pad_right| int | 0 | |
  526. | 19 | output_pad_bottom| int | output_pad_right | |
  527. | 20 | output_pad_behind| int | output_pad_right | |
  528. | 21 | kernel_d | int | kernel_w | |
  529. | 22 | dilation_d | int | dilation_w | |
  530. | 23 | stride_d | int | stride_w | |
  531. | 24 | pad_front | int | pad_left | |
  532. | 25 | output_w | int | 0 | |
  533. | 26 | output_h | int | output_w | |
  534. | 27 | output_d | int | output_w | |
  535. | weight | type | shape |
  536. | ------------- | ----- | --------------------- |
  537. | weight_data | float/fp16 | [kernel_w, kernel_h, kernel_d, num_input, num_output] |
  538. | bias_data | float | [num_output] |
  539. # DeconvolutionDepthWise
  540. ```
  541. x2 = deconv(x, weight, kernel, stride, dilation, group) + bias
  542. x3 = depad(x2, pads, pad_value)
  543. y = activation(x3, act_type, act_params)
  544. ```
  545. * one_blob_only
  546. | param id | name | type | default | description |
  547. | --------- | ------------- | ----- | --------- | ----------------- |
  548. | 0 | num_output | int | 0 | |
  549. | 1 | kernel_w | int | 0 | |
  550. | 2 | dilation_w | int | 1 | |
  551. | 3 | stride_w | int | 1 | |
  552. | 4 | pad_left | int | 0 | |
  553. | 5 | bias_term | int | 0 | |
  554. | 6 | weight_data_size| int | 0 | |
  555. | 7 | group | int | 1 | |
  556. | 9 | activation_type| int | 0 | |
  557. | 10 | activation_params| array | [ ] | |
  558. | 11 | kernel_h | int | kernel_w | |
  559. | 12 | dilation_h | int | dilation_w | |
  560. | 13 | stride_h | int | stride_w | |
  561. | 14 | pad_top | int | pad_left | |
  562. | 15 | pad_right | int | pad_left | |
  563. | 16 | pad_bottom | int | pad_top | |
  564. | 18 | output_pad_right| int | 0 | |
  565. | 19 | output_pad_bottom| int | output_pad_right | |
  566. | 20 | output_w | int | 0 | |
  567. | 21 | output_h | int | output_w | |
  568. | 28 | dynamic_weight| int | 0 | |
  569. | weight | type | shape |
  570. | ------------- | ----- | --------------------- |
  571. | weight_data | float/fp16 | [kernel_w, kernel_h, num_input / group, num_output / group, group] |
  572. | bias_data | float | [num_output] |
  573. # DeconvolutionDepthWise1D
  574. ```
  575. x2 = deconv1d(x, weight, kernel, stride, dilation, group) + bias
  576. x3 = depad(x2, pads, pad_value)
  577. y = activation(x3, act_type, act_params)
  578. ```
  579. * one_blob_only
  580. | param id | name | type | default | description |
  581. | --------- | ------------- | ----- | --------- | ----------------- |
  582. | 0 | num_output | int | 0 | |
  583. | 1 | kernel_w | int | 0 | |
  584. | 2 | dilation_w | int | 1 | |
  585. | 3 | stride_w | int | 1 | |
  586. | 4 | pad_left | int | 0 | |
  587. | 5 | bias_term | int | 0 | |
  588. | 6 | weight_data_size| int | 0 | |
  589. | 7 | group | int | 1 | |
  590. | 9 | activation_type| int | 0 | |
  591. | 10 | activation_params| array | [ ] | |
  592. | 15 | pad_right | int | pad_left | |
  593. | 18 | output_pad_right| int | 0 | |
  594. | 20 | output_w | int | 0 | |
  595. | 28 | dynamic_weight| int | 0 | |
  596. | weight | type | shape |
  597. | ------------- | ----- | --------------------- |
  598. | weight_data | float/fp16 | [kernel_w, num_input / group, num_output / group, group] |
  599. | bias_data | float | [num_output] |
  600. # DeconvolutionDepthWise3D
  601. ```
  602. x2 = deconv3d(x, weight, kernel, stride, dilation, group) + bias
  603. x3 = depad(x2, pads, pad_value)
  604. y = activation(x3, act_type, act_params)
  605. ```
  606. * one_blob_only
  607. | param id | name | type | default | description |
  608. | --------- | ------------- | ----- | --------- | ----------------- |
  609. | 0 | num_output | int | 0 | |
  610. | 1 | kernel_w | int | 0 | |
  611. | 2 | dilation_w | int | 1 | |
  612. | 3 | stride_w | int | 1 | |
  613. | 4 | pad_left | int | 0 | |
  614. | 5 | bias_term | int | 0 | |
  615. | 6 | weight_data_size| int | 0 | |
  616. | 7 | group | int | 1 | |
  617. | 9 | activation_type| int | 0 | |
  618. | 10 | activation_params| array | [ ] | |
  619. | 11 | kernel_h | int | kernel_w | |
  620. | 12 | dilation_h | int | dilation_w | |
  621. | 13 | stride_h | int | stride_w | |
  622. | 14 | pad_top | int | pad_left | |
  623. | 15 | pad_right | int | pad_left | |
  624. | 16 | pad_bottom | int | pad_top | |
  625. | 17 | pad_behind | int | pad_front | |
  626. | 18 | output_pad_right| int | 0 | |
  627. | 19 | output_pad_bottom| int | output_pad_right | |
  628. | 20 | output_pad_behind| int | output_pad_right | |
  629. | 21 | kernel_d | int | kernel_w | |
  630. | 22 | dilation_d | int | dilation_w | |
  631. | 23 | stride_d | int | stride_w | |
  632. | 24 | pad_front | int | pad_left | |
  633. | 25 | output_w | int | 0 | |
  634. | 26 | output_h | int | output_w | |
  635. | 27 | output_d | int | output_w | |
  636. | weight | type | shape |
  637. | ------------- | ----- | --------------------- |
  638. | weight_data | float/fp16 | [kernel_w, kernel_h, kernel_d, num_input / group, num_output / group, group] |
  639. | bias_data | float | [num_output] |
  640. # DeformableConv2D
  641. ```
  642. x2 = deformableconv2d(x, offset, mask, weight, kernel, stride, dilation) + bias
  643. y = activation(x2, act_type, act_params)
  644. ```
  645. | param id | name | type | default | description |
  646. | --------- | ------------- | ----- | --------- | ----------------- |
  647. | 0 | num_output | int | 0 | |
  648. | 1 | kernel_w | int | 0 | |
  649. | 2 | dilation_w | int | 1 | |
  650. | 3 | stride_w | int | 1 | |
  651. | 4 | pad_left | int | 0 | |
  652. | 5 | bias_term | int | 0 | |
  653. | 6 | weight_data_size| int | 0 | |
  654. | 9 | activation_type| int | 0 | |
  655. | 10 | activation_params| array | [ ] | |
  656. | 11 | kernel_h | int | kernel_w | |
  657. | 12 | dilation_h | int | dilation_w | |
  658. | 13 | stride_h | int | stride_w | |
  659. | 14 | pad_top | int | pad_left | |
  660. | 15 | pad_right | int | pad_left | |
  661. | 16 | pad_bottom | int | pad_top | |
  662. | weight | type | shape |
  663. | ------------- | ----- | --------------------- |
  664. | weight_data | float/fp16/int8 | [kernel_w, kernel_h, num_input, num_output] |
  665. | bias_data | float | [num_output] |
  666. # Dequantize
  667. ```
  668. y = x * scale + bias
  669. ```
  670. * one_blob_only
  671. * support_inplace
  672. | param id | name | type | default | description |
  673. | --------- | ------------- | ----- | --------- | ----------------- |
  674. | 0 | scale_data_size| int | 1 | |
  675. | 1 | bias_data_size| int | 0 | |
  676. | weight | type | shape |
  677. | ------------- | ----- | --------------------- |
  678. | scale_data | float | [scale_data_size] |
  679. | bias_data | float | [bias_data_size] |
  680. # Diag
  681. ```
  682. y = diag(x, diagonal)
  683. ```
  684. * one_blob_only
  685. | param id | name | type | default | description |
  686. | --------- | ------------- | ----- | --------- | ----------------- |
  687. | 0 | diagonal | int | 0 | |
  688. # Dropout
  689. ```
  690. y = x * scale
  691. ```
  692. * one_blob_only
  693. | param id | name | type | default | description |
  694. | --------- | ------------- | ----- | --------- | ----------------- |
  695. | 0 | scale | float | 1.f | |
  696. # Eltwise
  697. ```
  698. y = elementwise_op(x0, x1, ...)
  699. ```
  700. | param id | name | type | default | description |
  701. | --------- | ------------- | ----- | --------- | ----------------- |
  702. | 0 | op_type | int | 0 | |
  703. | 1 | coeffs | array | [ ] | |
  704. Operation type:
  705. - 0 = PROD
  706. - 1 = SUM
  707. - 2 = MAX
  708. # ELU
  709. ```
  710. if x < 0 y = (exp(x) - 1) * alpha
  711. else y = x
  712. ```
  713. * one_blob_only
  714. * support_inplace
  715. | param id | name | type | default | description |
  716. | --------- | ------------- | ----- | --------- | ----------------- |
  717. | 0 | alpha | float | 0.1f | |
  718. # Embed
  719. ```
  720. y = embedding(x)
  721. ```
  722. | param id | name | type | default | description |
  723. | --------- | ------------- | ----- | --------- | ----------------- |
  724. | 0 | num_output | int | 0 | |
  725. | 1 | input_dim | int | 0 | |
  726. | 2 | bias_term | int | 0 | |
  727. | 3 | weight_data_size | int | 0 | |
  728. | weight | type | shape |
  729. | ------------- | ----- | --------------------- |
  730. | weight_data | float | [weight_data_size] |
  731. | bias_term | float | [num_output] |
  732. # Exp
  733. ```
  734. if base == -1 y = exp(shift + x * scale)
  735. else y = pow(base, (shift + x * scale))
  736. ```
  737. * one_blob_only
  738. * support_inplace
  739. | param id | name | type | default | description |
  740. | --------- | ------------- | ----- | --------- | ----------------- |
  741. | 0 | base | float | -1.f | |
  742. | 1 | scale | float | 1.f | |
  743. | 2 | shift | float | 0.f | |
  744. # Flatten
  745. Reshape blob to 1 dimension
  746. * one_blob_only
  747. # Fold
  748. ```
  749. y = fold(x)
  750. ```
  751. * one_blob_only
  752. | param id | name | type | default | description |
  753. | --------- | ------------- | ----- | --------- | ----------------- |
  754. | 0 | num_output | int | 0 | |
  755. | 1 | kernel_w | int | 0 | |
  756. | 2 | dilation_w | int | 1 | |
  757. | 3 | stride_w | int | 1 | |
  758. | 4 | pad_left | int | 0 | |
  759. | 11 | kernel_h | int | kernel_w | |
  760. | 12 | dilation_h | int | dilation_w | |
  761. | 13 | stride_h | int | stride_w | |
  762. | 14 | pad_top | int | pad_left | |
  763. | 15 | pad_right | int | pad_left | |
  764. | 16 | pad_bottom | int | pad_top | |
  765. | 20 | output_w | int | 0 | |
  766. | 21 | output_h | int | output_w | |
  767. # GELU
  768. ```
  769. if fast_gelu == 1 y = 0.5 * x * (1 + tanh(0.79788452 * (x + 0.044715 * x * x * x)));
  770. else y = 0.5 * x * erfc(-0.70710678 * x)
  771. ```
  772. * one_blob_only
  773. * support_inplace
  774. | param id | name | type | default | description |
  775. | --------- | ------------- | ----- | --------- | ----------------- |
  776. | 0 | fast_gelu | int | 0 | use approximation |
  777. # GLU
  778. If axis < 0, we use axis = x.dims + axis
  779. GLU(a,b)=a⊗σ(b)
  780. where a is the first half of the input matrix and b is the second half.
  781. axis specifies the dimension to split the input
  782. * one_blob_only
  783. | param id | name | type | default | description |
  784. | --------- | ------------- | ----- | --------- | ----------------- |
  785. | 0 | axis | int | 0 | |
  786. # Gemm
  787. ```
  788. a = transA ? transpose(x0) : x0
  789. b = transb ? transpose(x1) : x1
  790. c = x2
  791. y = (gemm(a, b) + c * beta) * alpha
  792. ```
  793. | param id | name | type | default | description |
  794. | --------- | ------------- | ----- | --------- | ----------------- |
  795. | 0 | alpha | float | 1.f | |
  796. | 1 | beta | float | 1.f | |
  797. | 2 | transA | int | 0 | |
  798. | 3 | transb | int | 0 | |
  799. | 4 | constantA | int | 0 | |
  800. | 5 | constantB | int | 0 | |
  801. | 6 | constantC | int | 0 | |
  802. | 7 | constantM | int | 0 | |
  803. | 8 | constantN | int | 0 | |
  804. | 9 | constantK | int | 0 | |
  805. | 10 | constant_broadcast_type_C | int | 0 | |
  806. | 11 | output_N1M | int | 0 | |
  807. | 12 | output_elempack | int | 0 | |
  808. | 13 | output_elemtype | int | 0 | |
  809. | 14 | output_transpose | int| 0 | |
  810. | 20 | constant_TILE_M | int | 0 | |
  811. | 21 | constant_TILE_N | int | 0 | |
  812. | 22 | constant_TILE_K | int | 0 | |
  813. | weight | type | shape |
  814. | ------------- | ----- | --------------------- |
  815. | A_data | float | [M, K] or [K, M] |
  816. | B_data | float | [N, K] or [K, N] |
  817. | C_data | float | [1], [M] or [N] or [1, M] or [N,1] or [N, M] |
  818. # GridSample
  819. ```
  820. Given an input and a flow-field grid, computes the output using input values and pixel locations from grid.
  821. For each output location output[:, h2, w2], the size-2 vector grid[h2, w2, 2] specifies input pixel[:, h1, w1] locations x and y,
  822. which are used to interpolate the output value output[:, h2, w2]
  823. This function is often used in conjunction with affine_grid() to build Spatial Transformer Networks .
  824. ```
  825. | param id | name | type | default | description |
  826. | --------- | ------------- | ----- | --------- | ----------------- |
  827. | 0 | sample_type | int | 1 | |
  828. | 1 | padding_mode | int | 1 | |
  829. | 2 | align_corner | int | 0 | |
  830. | 3 | permute_fusion| int | 0 | fuse with permute |
  831. Sample type:
  832. - 1 = Nearest
  833. - 2 = Bilinear
  834. - 3 = Bicubic
  835. Padding mode:
  836. - 1 = zeros
  837. - 2 = border
  838. - 3 = reflection
  839. # GroupNorm
  840. ```
  841. split x along channel axis into group x0, x1 ...
  842. l2 normalize for each group x0, x1 ...
  843. y = x * gamma + beta
  844. ```
  845. * one_blob_only
  846. * support_inplace
  847. | param id | name | type | default | description |
  848. | --------- | ------------- | ----- | --------- | ----------------- |
  849. | 0 | group | int | 1 | |
  850. | 1 | channels | int | 0 | |
  851. | 2 | eps | float | 0.001f | x = x / sqrt(var + eps) |
  852. | 3 | affine | int | 1 | |
  853. | weight | type | shape |
  854. | ------------- | ----- | --------------------- |
  855. | gamma_data | float | [channels] |
  856. | beta_data | float | [channels] |
  857. # GRU
  858. Apply a single-layer GRU to a feature sequence of `T` timesteps. The input blob shape is `[w=input_size, h=T]` and the output blob shape is `[w=num_output, h=T]`.
  859. ```
  860. y = gru(x)
  861. y0, hidden y1 = gru(x0, hidden x1)
  862. ```
  863. * one_blob_only if bidirectional
  864. | param id | name | type | default | description |
  865. | --------- | ------------- | ----- | --------- | ----------------- |
  866. | 0 | num_output | int | 0 | hidden size of output |
  867. | 1 | weight_data_size| int | 0 | total size of weight matrix |
  868. | 2 | direction | int | 0 | 0=forward, 1=reverse, 2=bidirectional |
  869. | weight | type | shape |
  870. | ------------- | ----- | --------------------- |
  871. | weight_xc_data| float/fp16/int8 | [input_size, num_output * 3, num_directions] |
  872. | bias_c_data | float/fp16/int8 | [num_output, 4, num_directions] |
  873. | weight_hc_data| float/fp16/int8 | [num_output, num_output * 3, num_directions] |
  874. Direction flag:
  875. - 0 = forward only
  876. - 1 = reverse only
  877. - 2 = bidirectional
  878. # HardSigmoid
  879. ```
  880. y = clamp(x * alpha + beta, 0, 1)
  881. ```
  882. * one_blob_only
  883. * support_inplace
  884. | param id | name | type | default | description |
  885. | --------- | ------------- | ----- | --------- | ----------------- |
  886. | 0 | alpha | float | 0.2f | |
  887. | 1 | beta | float | 0.5f | |
  888. # HardSwish
  889. ```
  890. y = x * clamp(x * alpha + beta, 0, 1)
  891. ```
  892. * one_blob_only
  893. * support_inplace
  894. | param id | name | type | default | description |
  895. | --------- | ------------- | ----- | --------- | ----------------- |
  896. | 0 | alpha | float | 0.2f | |
  897. | 1 | beta | float | 0.5f | |
  898. # InnerProduct
  899. ```
  900. x2 = innerproduct(x, weight) + bias
  901. y = activation(x2, act_type, act_params)
  902. ```
  903. * one_blob_only
  904. | param id | name | type | default | description |
  905. | --------- | ------------- | ----- | --------- | ----------------- |
  906. | 0 | num_output | int | 0 | |
  907. | 1 | bias_term | int | 0 | |
  908. | 2 | weight_data_size| int | 0 | |
  909. | 8 | int8_scale_term| int | 0 | |
  910. | 9 | activation_type| int | 0 | |
  911. | 10 | activation_params| array | [ ] | |
  912. | weight | type | shape |
  913. | ------------- | ----- | --------------------- |
  914. | weight_data | float/fp16/int8 | [num_input, num_output] |
  915. | bias_data | float | [num_output] |
  916. | weight_data_int8_scales| float | [num_output] |
  917. | bottom_blob_int8_scales| float | [1] |
  918. # Input
  919. ```
  920. y = input
  921. ```
  922. * support_inplace
  923. | param id | name | type | default | description |
  924. | --------- | ------------- | ----- | --------- | ----------------- |
  925. | 0 | w | int | 0 | |
  926. | 1 | h | int | 0 | |
  927. | 11 | d | int | 0 | |
  928. | 2 | c | int | 0 | |
  929. # InstanceNorm
  930. ```
  931. split x along channel axis into instance x0, x1 ...
  932. l2 normalize for each channel instance x0, x1 ...
  933. y = x * gamma + beta
  934. ```
  935. * one_blob_only
  936. * support_inplace
  937. | param id | name | type | default | description |
  938. | --------- | ------------- | ----- | --------- | ----------------- |
  939. | 0 | channels | int | 0 | |
  940. | 1 | eps | float | 0.001f | x = x / sqrt(var + eps) |
  941. | 2 | affine | int | 1 | |
  942. | weight | type | shape |
  943. | ------------- | ----- | --------------------- |
  944. | gamma_data | float | [channels] |
  945. | beta_data | float | [channels] |
  946. # Interp
  947. ```
  948. if dynamic_target_size == 0 y = resize(x) by fixed size or scale
  949. else y = resize(x0, size(x1))
  950. ```
  951. * one_blob_only if dynamic_target_size == 0
  952. | param id | name | type | default | description |
  953. | --------- | ------------- | ----- | --------- | ----------------- |
  954. | 0 | resize_type | int | 0 | |
  955. | 1 | height_scale | float | 1.f | |
  956. | 2 | width_scale | float | 1.f | |
  957. | 3 | output_height | int | 0 | |
  958. | 4 | output_width | int | 0 | |
  959. | 5 | dynamic_target_size| int | 0 | |
  960. | 6 | align_corner | int | 0 | |
  961. Resize type:
  962. - 1 = Nearest
  963. - 2 = Bilinear
  964. - 3 = Bicubic
  965. # LayerNorm
  966. ```
  967. split x along outmost axis into part x0, x1 ...
  968. l2 normalize for each part x0, x1 ...
  969. y = x * gamma + beta by elementwise
  970. ```
  971. * one_blob_only
  972. * support_inplace
  973. | param id | name | type | default | description |
  974. | --------- | ------------- | ----- | --------- | ----------------- |
  975. | 0 | affine_size | int | 0 | |
  976. | 1 | eps | float | 0.001f | x = x / sqrt(var + eps) |
  977. | 2 | affine | int | 1 | |
  978. | weight | type | shape |
  979. | ------------- | ----- | --------------------- |
  980. | gamma_data | float | [affine_size] |
  981. | beta_data | float | [affine_size] |
  982. # Log
  983. ```
  984. if base == -1 y = log(shift + x * scale)
  985. else y = log(shift + x * scale) / log(base)
  986. ```
  987. * one_blob_only
  988. * support_inplace
  989. | param id | name | type | default | description |
  990. | --------- | ------------- | ----- | --------- | ----------------- |
  991. | 0 | base | float | -1.f | |
  992. | 1 | scale | float | 1.f | |
  993. | 2 | shift | float | 0.f | |
  994. # LRN
  995. ```
  996. if region_type == ACROSS_CHANNELS square_sum = sum of channel window of local_size
  997. if region_type == WITHIN_CHANNEL square_sum = sum of spatial window of local_size
  998. y = x * pow(bias + alpha * square_sum / (local_size * local_size), -beta)
  999. ```
  1000. * one_blob_only
  1001. * support_inplace
  1002. | param id | name | type | default | description |
  1003. | --------- | ------------- | ----- | --------- | ----------------- |
  1004. | 0 | region_type | int | 0 | |
  1005. | 1 | local_size | int | 5 | |
  1006. | 2 | alpha | float | 1.f | |
  1007. | 3 | beta | float | 0.75f | |
  1008. | 4 | bias | float | 1.f | |
  1009. Region type:
  1010. - 0 = ACROSS_CHANNELS
  1011. - 1 = WITHIN_CHANNEL
  1012. # LSTM
  1013. Apply a single-layer LSTM to a feature sequence of `T` timesteps. The input blob shape is `[w=input_size, h=T]` and the output blob shape is `[w=num_output, h=T]`.
  1014. ```
  1015. y = lstm(x)
  1016. y0, hidden y1, cell y2 = lstm(x0, hidden x1, cell x2)
  1017. ```
  1018. * one_blob_only if bidirectional
  1019. | param id | name | type | default | description |
  1020. | --------- | ------------- | ----- | --------- | ----------------- |
  1021. | 0 | num_output | int | 0 | output size of output |
  1022. | 1 | weight_data_size| int | 0 | total size of IFOG weight matrix |
  1023. | 2 | direction | int | 0 | 0=forward, 1=reverse, 2=bidirectional |
  1024. | 3 | hidden_size | int | num_output| hidden size |
  1025. | weight | type | shape |
  1026. | ------------- | ----- | --------------------- |
  1027. | weight_xc_data| float/fp16/int8 | [input_size, hidden_size * 4, num_directions] |
  1028. | bias_c_data | float/fp16/int8 | [hidden_size, 4, num_directions] |
  1029. | weight_hc_data| float/fp16/int8 | [num_output, hidden_size * 4, num_directions] |
  1030. | weight_hr_data| float/fp16/int8 | [hidden_size, num_output, num_directions] |
  1031. Direction flag:
  1032. - 0 = forward only
  1033. - 1 = reverse only
  1034. - 2 = bidirectional
  1035. # MemoryData
  1036. ```
  1037. y = data
  1038. ```
  1039. | param id | name | type | default | description |
  1040. | --------- | ------------- | ----- | --------- | ----------------- |
  1041. | 0 | w | int | 0 | |
  1042. | 1 | h | int | 0 | |
  1043. | 11 | d | int | 0 | |
  1044. | 2 | c | int | 0 | |
  1045. | 21 | load_type | int | 1 | 1=fp32 |
  1046. | weight | type | shape |
  1047. | ------------- | ----- | --------------------- |
  1048. | data | float | [w, h, d, c] |
  1049. # Mish
  1050. ```
  1051. y = x * tanh(log(exp(x) + 1))
  1052. ```
  1053. * one_blob_only
  1054. * support_inplace
  1055. # MultiHeadAttention
  1056. ```
  1057. split q k v into num_head part q0, k0, v0, q1, k1, v1 ...
  1058. for each num_head part
  1059. xq = affine(q) / (embed_dim / num_head)
  1060. xk = affine(k)
  1061. xv = affine(v)
  1062. xqk = xq * xk
  1063. xqk = xqk + attn_mask if attn_mask exists
  1064. softmax_inplace(xqk)
  1065. xqkv = xqk * xv
  1066. merge xqkv to out
  1067. y = affine(out)
  1068. ```
  1069. | param id | name | type | default | description |
  1070. | --------- | ------------- | ----- | --------- | ----------------- |
  1071. | 0 | embed_dim | int | 0 | |
  1072. | 1 | num_heads | int | 1 | |
  1073. | 2 | weight_data_size| int | 0 | qdim = weight_data_size / embed_dim |
  1074. | 3 | kdim | int | embed_dim | |
  1075. | 4 | vdim | int | embed_dim | |
  1076. | 5 | attn_mask | int | 0 | |
  1077. | 6 | scale | float | 1.f / sqrt(embed_dim / num_heads) | |
  1078. | weight | type | shape |
  1079. | ------------- | ----- | --------------------- |
  1080. | q_weight_data | float/fp16/int8 | [embed_dim * qdim] |
  1081. | q_bias_data | float | [embed_dim] |
  1082. | k_weight_data | float/fp16/int8 | [embed_dim * kdim] |
  1083. | k_bias_data | float | [embed_dim] |
  1084. | v_weight_data | float/fp16/int8 | [embed_dim * vdim] |
  1085. | v_bias_data | float | [embed_dim] |
  1086. | out_weight_data| float/fp16/int8 | [qdim * embed_dim] |
  1087. | out_bias_data | float | [qdim] |
  1088. # MVN
  1089. ```
  1090. if normalize_variance == 1 && across_channels == 1 y = (x - mean) / (sqrt(var) + eps) of whole blob
  1091. if normalize_variance == 1 && across_channels == 0 y = (x - mean) / (sqrt(var) + eps) of each channel
  1092. if normalize_variance == 0 && across_channels == 1 y = x - mean of whole blob
  1093. if normalize_variance == 0 && across_channels == 0 y = x - mean of each channel
  1094. ```
  1095. * one_blob_only
  1096. | param id | name | type | default | description |
  1097. | --------- | ------------- | ----- | --------- | ----------------- |
  1098. | 0 | normalize_variance| int | 0 | |
  1099. | 1 | across_channels| int | 0 | |
  1100. | 2 | eps | float | 0.0001f | x = x / (sqrt(var) + eps) |
  1101. # Noop
  1102. ```
  1103. y = x
  1104. ```
  1105. # Normalize
  1106. ```
  1107. if across_spatial == 1 && across_channel == 1 x2 = normalize(x) of whole blob
  1108. if across_spatial == 1 && across_channel == 0 x2 = normalize(x) of each channel
  1109. if across_spatial == 0 && across_channel == 1 x2 = normalize(x) of each position
  1110. y = x2 * scale
  1111. ```
  1112. * one_blob_only
  1113. * support_inplace
  1114. | param id | name | type | default | description |
  1115. | --------- | ------------- | ----- | --------- | ----------------- |
  1116. | 0 | across_spatial| int | 0 | |
  1117. | 1 | channel_shared| int | 0 | |
  1118. | 2 | eps | float | 0.0001f | see eps mode |
  1119. | 3 | scale_data_size| int | 0 | |
  1120. | 4 | across_channel| int | 0 | |
  1121. | 9 | eps_mode | int | 0 | |
  1122. | weight | type | shape |
  1123. | ------------- | ----- | --------------------- |
  1124. | scale_data | float | [scale_data_size] |
  1125. Eps Mode:
  1126. - 0 = caffe/mxnet x = x / sqrt(var + eps)
  1127. - 1 = pytorch x = x / max(sqrt(var), eps)
  1128. - 2 = tensorflow x = x / sqrt(max(var, eps))
  1129. # Packing
  1130. ```
  1131. y = wrap_packing(x)
  1132. ```
  1133. * one_blob_only
  1134. | param id | name | type | default | description |
  1135. | --------- | ------------- | ----- | --------- | ----------------- |
  1136. | 0 | out_elempack | int | 1 | |
  1137. | 1 | use_padding | int | 0 | |
  1138. | 2 | cast_type_from| int | 0 | |
  1139. | 3 | cast_type_to | int | 0 | |
  1140. | 4 | storage_type_from| int | 0 | |
  1141. | 5 | storage_type_to| int | 0 | |
  1142. # Padding
  1143. ```
  1144. y = pad(x, pads)
  1145. ```
  1146. | param id | name | type | default | description |
  1147. | --------- | ------------- | ---- | --------- | ----------------- |
  1148. | 0 | top | int | 0 | |
  1149. | 1 | bottom | int | 0 | |
  1150. | 2 | left | int | 0 | |
  1151. | 3 | right | int | 0 | |
  1152. | 4 | type | int | 0 | |
  1153. | 5 | value | float | 0 | |
  1154. | 6 | per_channel_pad_data_size| int | 0 | |
  1155. | 7 | front | int | stride_w | |
  1156. | 8 | behind | int | pad_left | |
  1157. | weight | type | shape |
  1158. | ------------- | ----- | --------------------- |
  1159. | per_channel_pad_data| float | [per_channel_pad_data_size] |
  1160. Padding type:
  1161. - 0 = CONSTANT
  1162. - 1 = REPLICATE
  1163. - 2 = REFLECT
  1164. # Permute
  1165. ```
  1166. y = reorder(x)
  1167. ```
  1168. | param id | name | type | default | description |
  1169. | --------- | ------------- | ---- | --------- | ----------------- |
  1170. | 0 | order_type | int | 0 | |
  1171. Order Type:
  1172. - 0 = WH WHC WHDC
  1173. - 1 = HW HWC HWDC
  1174. - 2 = WCH WDHC
  1175. - 3 = CWH DWHC
  1176. - 4 = HCW HDWC
  1177. - 5 = CHW DHWC
  1178. - 6 = WHCD
  1179. - 7 = HWCD
  1180. - 8 = WCHD
  1181. - 9 = CWHD
  1182. - 10 = HCWD
  1183. - 11 = CHWD
  1184. - 12 = WDCH
  1185. - 13 = DWCH
  1186. - 14 = WCDH
  1187. - 15 = CWDH
  1188. - 16 = DCWH
  1189. - 17 = CDWH
  1190. - 18 = HDCW
  1191. - 19 = DHCW
  1192. - 20 = HCDW
  1193. - 21 = CHDW
  1194. - 22 = DCHW
  1195. - 23 = CDHW
  1196. # PixelShuffle
  1197. ```
  1198. if mode == 0 y = depth_to_space(x) where x channel order is sw-sh-outc
  1199. if mode == 1 y = depth_to_space(x) where x channel order is outc-sw-sh
  1200. ```
  1201. * one_blob_only
  1202. | param id | name | type | default | description |
  1203. | --------- | ------------- | ---- | --------- | ----------------- |
  1204. | 0 | upscale_factor| int | 1 | |
  1205. | 1 | mode | int | 0 | |
  1206. # Pooling
  1207. ```
  1208. x2 = pad(x, pads)
  1209. x3 = pooling(x2, kernel, stride)
  1210. ```
  1211. | param id | name | type | default | description |
  1212. | --------- | --------------| ---- | --------- | ----------------- |
  1213. | 0 | pooling_type | int | 0 | |
  1214. | 1 | kernel_w | int | 0 | |
  1215. | 2 | stride_w | int | 1 | |
  1216. | 3 | pad_left | int | 0 | |
  1217. | 4 | global_pooling| int | 0 | |
  1218. | 5 | pad_mode | int | 0 | |
  1219. | 6 | avgpool_count_include_pad| int | 0 | |
  1220. | 7 | adaptive_pooling| int | 0 | |
  1221. | 8 | out_w | int | 0 | |
  1222. | 11 | kernel_h | int | kernel_w | |
  1223. | 12 | stride_h | int | stride_w | |
  1224. | 13 | pad_top | int | pad_left | |
  1225. | 14 | pad_right | int | pad_left | |
  1226. | 15 | pad_bottom | int | pad_top | |
  1227. | 18 | out_h | int | out_w | |
  1228. Pooling type:
  1229. - 0 = MAX
  1230. - 1 = AVG
  1231. Pad mode:
  1232. - 0 = full padding
  1233. - 1 = valid padding
  1234. - 2 = tensorflow padding=SAME or onnx padding=SAME_UPPER
  1235. - 3 = onnx padding=SAME_LOWER
  1236. # Pooling1D
  1237. ```
  1238. x2 = pad(x, pads)
  1239. x3 = pooling1d(x2, kernel, stride)
  1240. ```
  1241. | param id | name | type | default | description |
  1242. | --------- | --------------| ---- | --------- | ----------------- |
  1243. | 0 | pooling_type | int | 0 | |
  1244. | 1 | kernel_w | int | 0 | |
  1245. | 2 | stride_w | int | 1 | |
  1246. | 3 | pad_left | int | 0 | |
  1247. | 4 | global_pooling| int | 0 | |
  1248. | 5 | pad_mode | int | 0 | |
  1249. | 6 | avgpool_count_include_pad| int | 0 | |
  1250. | 7 | adaptive_pooling| int | 0 | |
  1251. | 8 | out_w | int | 0 | |
  1252. | 14 | pad_right | int | pad_left | |
  1253. Pooling type:
  1254. - 0 = MAX
  1255. - 1 = AVG
  1256. Pad mode:
  1257. - 0 = full padding
  1258. - 1 = valid padding
  1259. - 2 = tensorflow padding=SAME or onnx padding=SAME_UPPER
  1260. - 3 = onnx padding=SAME_LOWER
  1261. # Pooling3D
  1262. ```
  1263. x2 = pad(x, pads)
  1264. x3 = pooling3d(x2, kernel, stride)
  1265. ```
  1266. | param id | name | type | default | description |
  1267. | --------- | --------------| ---- | --------- | ----------------- |
  1268. | 0 | pooling_type | int | 0 | |
  1269. | 1 | kernel_w | int | 0 | |
  1270. | 2 | stride_w | int | 1 | |
  1271. | 3 | pad_left | int | 0 | |
  1272. | 4 | global_pooling| int | 0 | |
  1273. | 5 | pad_mode | int | 0 | |
  1274. | 6 | avgpool_count_include_pad| int | 0 | |
  1275. | 7 | adaptive_pooling| int | 0 | |
  1276. | 8 | out_w | int | 0 | |
  1277. | 11 | kernel_h | int | kernel_w | |
  1278. | 12 | stride_h | int | stride_w | |
  1279. | 13 | pad_top | int | pad_left | |
  1280. | 14 | pad_right | int | pad_left | |
  1281. | 15 | pad_bottom | int | pad_top | |
  1282. | 16 | pad_behind | int | pad_front | |
  1283. | 18 | out_h | int | out_w | |
  1284. | 21 | kernel_d | int | kernel_w | |
  1285. | 22 | stride_d | int | stride_w | |
  1286. | 23 | pad_front | int | pad_left | |
  1287. | 28 | out_d | int | out_w | |
  1288. Pooling type:
  1289. - 0 = MAX
  1290. - 1 = AVG
  1291. Pad mode:
  1292. - 0 = full padding
  1293. - 1 = valid padding
  1294. - 2 = tensorflow padding=SAME or onnx padding=SAME_UPPER
  1295. - 3 = onnx padding=SAME_LOWER
  1296. # Power
  1297. ```
  1298. y = pow((shift + x * scale), power)
  1299. ```
  1300. * one_blob_only
  1301. * support_inplace
  1302. | param id | name | type | default | description |
  1303. | --------- | ------------- | ----- | --------- | ----------------- |
  1304. | 0 | power | float | 1.f | |
  1305. | 1 | scale | float | 1.f | |
  1306. | 2 | shift | float | 0.f | |
  1307. # PReLU
  1308. ```
  1309. if x < 0 y = x * slope
  1310. else y = x
  1311. ```
  1312. * one_blob_only
  1313. * support_inplace
  1314. | param id | name | type | default | description |
  1315. | --------- | ------------- | ----- | --------- | ----------------- |
  1316. | 0 | num_slope | int | 0 | |
  1317. | weight | type | shape |
  1318. | ------------- | ----- | --------------------- |
  1319. | slope_data | float | [num_slope] |
  1320. # Quantize
  1321. ```
  1322. y = float2int8(x * scale)
  1323. ```
  1324. * one_blob_only
  1325. | param id | name | type | default | description |
  1326. | --------- | ------------- | ----- | --------- | ----------------- |
  1327. | 0 | scale_data_size| int | 1 | |
  1328. | weight | type | shape |
  1329. | ------------- | ----- | --------------------- |
  1330. | scale_data | float | [scale_data_size] |
  1331. # Reduction
  1332. ```
  1333. y = reduce_op(x * coeff)
  1334. ```
  1335. * one_blob_only
  1336. | param id | name | type | default | description |
  1337. | --------- | ------------- | ----- | --------- | ----------------- |
  1338. | 0 | operation | int | 0 | |
  1339. | 1 | reduce_all | int | 1 | |
  1340. | 2 | coeff | float | 1.f | |
  1341. | 3 | axes | array | [ ] | |
  1342. | 4 | keepdims | int | 0 | |
  1343. | 5 | fixbug0 | int | 0 | hack for bug fix, should be 1 |
  1344. Operation type:
  1345. - 0 = SUM
  1346. - 1 = ASUM
  1347. - 2 = SUMSQ
  1348. - 3 = MEAN
  1349. - 4 = MAX
  1350. - 5 = MIN
  1351. - 6 = PROD
  1352. - 7 = L1
  1353. - 8 = L2
  1354. - 9 = LogSum
  1355. - 10 = LogSumExp
  1356. # ReLU
  1357. ```
  1358. if x < 0 y = x * slope
  1359. else y = x
  1360. ```
  1361. * one_blob_only
  1362. * support_inplace
  1363. | param id | name | type | default | description |
  1364. | --------- | ------------- | ----- | --------- | ----------------- |
  1365. | 0 | slope | float | 0.f | |
  1366. # Reorg
  1367. ```
  1368. if mode == 0 y = space_to_depth(x) where x channel order is sw-sh-outc
  1369. if mode == 1 y = space_to_depth(x) where x channel order is outc-sw-sh
  1370. ```
  1371. * one_blob_only
  1372. | param id | name | type | default | description |
  1373. | --------- | ------------- | ---- | --------- | ----------------- |
  1374. | 0 | stride | int | 1 | |
  1375. | 1 | mode | int | 0 | |
  1376. # Requantize
  1377. ```
  1378. x2 = x * scale_in + bias
  1379. x3 = activation(x2)
  1380. y = float2int8(x3 * scale_out)
  1381. ```
  1382. * one_blob_only
  1383. | param id | name | type | default | description |
  1384. | --------- | ------------- | ----- | --------- | ----------------- |
  1385. | 0 | scale_in_data_size| int | 1 | |
  1386. | 1 | scale_out_data_size| int | 1 | |
  1387. | 2 | bias_data_size| int | 0 | |
  1388. | 3 | activation_type| int | 0 | |
  1389. | 4 | activation_params| int | [ ] | |
  1390. | weight | type | shape |
  1391. | ------------- | ----- | --------------------- |
  1392. | scale_in_data | float | [scale_in_data_size] |
  1393. | scale_out_data| float | [scale_out_data_size] |
  1394. | bias_data | float | [bias_data_size] |
  1395. # Reshape
  1396. ```
  1397. if permute == 1 y = hwc2chw(reshape(chw2hwc(x)))
  1398. else y = reshape(x)
  1399. ```
  1400. * one_blob_only
  1401. | param id | name | type | default | description |
  1402. | --------- | ------------- | ----- | --------- | ----------------- |
  1403. | 0 | w | int | -233 | |
  1404. | 1 | h | int | -233 | |
  1405. | 11 | d | int | -233 | |
  1406. | 2 | c | int | -233 | |
  1407. | 3 | permute | int | 0 | |
  1408. Reshape flag:
  1409. - 0 = copy from bottom
  1410. - -1 = remaining
  1411. - -233 = drop this dim(default)
  1412. # RMSNorm
  1413. ```
  1414. split x along outmost axis into part x0, x1 ...
  1415. root mean square normalize for each part x0, x1 ...
  1416. y = x * gamma by elementwise
  1417. ```
  1418. * one_blob_only
  1419. * support_inplace
  1420. | param id | name | type | default | description |
  1421. | --------- | ------------- | ----- | --------- | ----------------- |
  1422. | 0 | affine_size | int | 0 | |
  1423. | 1 | eps | float | 0.001f | x = x / sqrt(var + eps) |
  1424. | 2 | affine | int | 1 | |
  1425. | weight | type | shape |
  1426. | ------------- | ----- | --------------------- |
  1427. | gamma_data | float | [affine_size] |
  1428. # RNN
  1429. Apply a single-layer RNN to a feature sequence of `T` timesteps. The input blob shape is `[w=input_size, h=T]` and the output blob shape is `[w=num_output, h=T]`.
  1430. ```
  1431. y = rnn(x)
  1432. y0, hidden y1 = rnn(x0, hidden x1)
  1433. ```
  1434. * one_blob_only if bidirectional
  1435. | param id | name | type | default | description |
  1436. | --------- | ------------- | ----- | --------- | ----------------- |
  1437. | 0 | num_output | int | 0 | hidden size of output |
  1438. | 1 | weight_data_size| int | 0 | total size of weight matrix |
  1439. | 2 | direction | int | 0 | 0=forward, 1=reverse, 2=bidirectional |
  1440. | weight | type | shape |
  1441. | ------------- | ----- | --------------------- |
  1442. | weight_xc_data| float/fp16/int8 | [input_size, num_output, num_directions] |
  1443. | bias_c_data | float/fp16/int8 | [num_output, 1, num_directions] |
  1444. | weight_hc_data| float/fp16/int8 | [num_output, num_output, num_directions] |
  1445. Direction flag:
  1446. - 0 = forward only
  1447. - 1 = reverse only
  1448. - 2 = bidirectional
  1449. # Scale
  1450. ```
  1451. if scale_data_size == -233 y = x0 * x1
  1452. else y = x * scale + bias
  1453. ```
  1454. * one_blob_only if scale_data_size != -233
  1455. * support_inplace
  1456. | param id | name | type | default | description |
  1457. | --------- | ------------- | ----- | --------- | ----------------- |
  1458. | 0 | scale_data_size| int | 0 | |
  1459. | 1 | bias_term | int | 0 | |
  1460. | weight | type | shape |
  1461. | ------------- | ----- | --------------------- |
  1462. | scale_data | float | [scale_data_size] |
  1463. | bias_data | float | [scale_data_size] |
  1464. # SELU
  1465. ```
  1466. if x < 0 y = (exp(x) - 1.f) * alpha * lambda
  1467. else y = x * lambda
  1468. ```
  1469. * one_blob_only
  1470. * support_inplace
  1471. | param id | name | type | default | description |
  1472. | --------- | ------------- | ----- | --------- | ----------------- |
  1473. | 0 | alpha | float | 1.67326324f| |
  1474. | 1 | lambda | float | 1.050700987f| |
  1475. # Shrink
  1476. ```
  1477. if x < -lambd y = x + bias
  1478. if x > lambd y = x - bias
  1479. else y = x
  1480. ```
  1481. * one_blob_only
  1482. * support_inplace
  1483. | param id | name | type | default | description |
  1484. | --------- | ------------- | ----- | --------- | ----------------- |
  1485. | 0 | bias | float | 0.0f | |
  1486. | 1 | lambd | float | 0.5f | |
  1487. # ShuffleChannel
  1488. ```
  1489. if reverse == 0 y = shufflechannel(x) by group
  1490. if reverse == 1 y = shufflechannel(x) by channel / group
  1491. ```
  1492. * one_blob_only
  1493. | param id | name | type | default | description |
  1494. | --------- | ------------- | ---- | --------- | ----------------- |
  1495. | 0 | group | int | 1 | |
  1496. | 1 | reverse | int | 0 | |
  1497. # Sigmoid
  1498. ```
  1499. y = 1 / (1 + exp(-x))
  1500. ```
  1501. * one_blob_only
  1502. * support_inplace
  1503. # Slice
  1504. ```
  1505. split x along axis into slices, each part slice size is based on slices array
  1506. ```
  1507. | param id | name | type | default | description |
  1508. | --------- | ------------- | ----- | --------- | ----------------- |
  1509. | 0 | slices | array | [ ] | |
  1510. | 1 | axis | int | 0 | |
  1511. | 2 | indices | array | [ ] | |
  1512. # Softmax
  1513. ```
  1514. softmax(x, axis)
  1515. ```
  1516. * one_blob_only
  1517. * support_inplace
  1518. | param id | name | type | default | description |
  1519. | --------- | ------------- | ----- | --------- | ----------------- |
  1520. | 0 | axis | int | 0 | |
  1521. | 1 | fixbug0 | int | 0 | hack for bug fix, should be 1 |
  1522. # Softplus
  1523. ```
  1524. y = log(exp(x) + 1)
  1525. ```
  1526. * one_blob_only
  1527. * support_inplace
  1528. # Split
  1529. ```
  1530. y0, y1 ... = x
  1531. ```
  1532. # Swish
  1533. ```
  1534. y = x / (1 + exp(-x))
  1535. ```
  1536. * one_blob_only
  1537. * support_inplace
  1538. # TanH
  1539. ```
  1540. y = tanh(x)
  1541. ```
  1542. * one_blob_only
  1543. * support_inplace
  1544. # Threshold
  1545. ```
  1546. if x > threshold y = 1
  1547. else y = 0
  1548. ```
  1549. * one_blob_only
  1550. * support_inplace
  1551. | param id | name | type | default | description |
  1552. | --------- | ------------- | ----- | --------- | ----------------- |
  1553. | 0 | threshold | float | 0.f | |
  1554. # Tile
  1555. ```
  1556. y = repeat tiles along axis for x
  1557. ```
  1558. * one_blob_only
  1559. | param id | name | type | default | description |
  1560. | --------- | ------------- | ----- | --------- | ----------------- |
  1561. | 0 | axis | int | 0 | |
  1562. | 1 | tiles | int | 1 | |
  1563. | 2 | repeats | array | [ ] | |
  1564. # UnaryOp
  1565. ```
  1566. y = unaryop(x)
  1567. ```
  1568. - one_blob_only
  1569. - support_inplace
  1570. | param id | name | type | default | description |
  1571. | --------- | ------------- | ----- | --------- | ----------------- |
  1572. | 0 | op_type | int | 0 | Operation type as follows |
  1573. Operation type:
  1574. - 0 = ABS
  1575. - 1 = NEG
  1576. - 2 = FLOOR
  1577. - 3 = CEIL
  1578. - 4 = SQUARE
  1579. - 5 = SQRT
  1580. - 6 = RSQ
  1581. - 7 = EXP
  1582. - 8 = LOG
  1583. - 9 = SIN
  1584. - 10 = COS
  1585. - 11 = TAN
  1586. - 12 = ASIN
  1587. - 13 = ACOS
  1588. - 14 = ATAN
  1589. - 15 = RECIPROCAL
  1590. - 16 = TANH
  1591. - 17 = LOG10
  1592. - 18 = ROUND
  1593. - 19 = TRUNC
  1594. # Unfold
  1595. ```
  1596. y = unfold(x)
  1597. ```
  1598. * one_blob_only
  1599. | param id | name | type | default | description |
  1600. | --------- | ------------- | ----- | --------- | ----------------- |
  1601. | 0 | num_output | int | 0 | |
  1602. | 1 | kernel_w | int | 0 | |
  1603. | 2 | dilation_w | int | 1 | |
  1604. | 3 | stride_w | int | 1 | |
  1605. | 4 | pad_left | int | 0 | |
  1606. | 11 | kernel_h | int | kernel_w | |
  1607. | 12 | dilation_h | int | dilation_w | |
  1608. | 13 | stride_h | int | stride_w | |
  1609. | 14 | pad_top | int | pad_left | |
  1610. | 15 | pad_right | int | pad_left | |
  1611. | 16 | pad_bottom | int | pad_top | |