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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924
  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. | 18 | int8_scale_term| int | 0 | |
  729. | weight | type | shape |
  730. | ------------- | ----- | --------------------- |
  731. | weight_data | float | [weight_data_size] |
  732. | bias_term | float | [num_output] |
  733. | weight_data_int8_scales| float | [1] |
  734. # Exp
  735. ```
  736. if base == -1 y = exp(shift + x * scale)
  737. else y = pow(base, (shift + x * scale))
  738. ```
  739. * one_blob_only
  740. * support_inplace
  741. | param id | name | type | default | description |
  742. | --------- | ------------- | ----- | --------- | ----------------- |
  743. | 0 | base | float | -1.f | |
  744. | 1 | scale | float | 1.f | |
  745. | 2 | shift | float | 0.f | |
  746. # Flatten
  747. Reshape blob to 1 dimension
  748. * one_blob_only
  749. # Fold
  750. ```
  751. y = fold(x)
  752. ```
  753. * one_blob_only
  754. | param id | name | type | default | description |
  755. | --------- | ------------- | ----- | --------- | ----------------- |
  756. | 0 | num_output | int | 0 | |
  757. | 1 | kernel_w | int | 0 | |
  758. | 2 | dilation_w | int | 1 | |
  759. | 3 | stride_w | int | 1 | |
  760. | 4 | pad_left | int | 0 | |
  761. | 11 | kernel_h | int | kernel_w | |
  762. | 12 | dilation_h | int | dilation_w | |
  763. | 13 | stride_h | int | stride_w | |
  764. | 14 | pad_top | int | pad_left | |
  765. | 15 | pad_right | int | pad_left | |
  766. | 16 | pad_bottom | int | pad_top | |
  767. | 20 | output_w | int | 0 | |
  768. | 21 | output_h | int | output_w | |
  769. # GELU
  770. ```
  771. if fast_gelu == 1 y = 0.5 * x * (1 + tanh(0.79788452 * (x + 0.044715 * x * x * x)));
  772. else y = 0.5 * x * erfc(-0.70710678 * x)
  773. ```
  774. * one_blob_only
  775. * support_inplace
  776. | param id | name | type | default | description |
  777. | --------- | ------------- | ----- | --------- | ----------------- |
  778. | 0 | fast_gelu | int | 0 | use approximation |
  779. # GLU
  780. If axis < 0, we use axis = x.dims + axis
  781. GLU(a,b)=a⊗σ(b)
  782. where a is the first half of the input matrix and b is the second half.
  783. axis specifies the dimension to split the input
  784. * one_blob_only
  785. | param id | name | type | default | description |
  786. | --------- | ------------- | ----- | --------- | ----------------- |
  787. | 0 | axis | int | 0 | |
  788. # Gemm
  789. ```
  790. a = transA ? transpose(x0) : x0
  791. b = transb ? transpose(x1) : x1
  792. c = x2
  793. y = (gemm(a, b) + c * beta) * alpha
  794. ```
  795. | param id | name | type | default | description |
  796. | --------- | ------------- | ----- | --------- | ----------------- |
  797. | 0 | alpha | float | 1.f | |
  798. | 1 | beta | float | 1.f | |
  799. | 2 | transA | int | 0 | |
  800. | 3 | transb | int | 0 | |
  801. | 4 | constantA | int | 0 | |
  802. | 5 | constantB | int | 0 | |
  803. | 6 | constantC | int | 0 | |
  804. | 7 | constantM | int | 0 | |
  805. | 8 | constantN | int | 0 | |
  806. | 9 | constantK | int | 0 | |
  807. | 10 | constant_broadcast_type_C | int | 0 | |
  808. | 11 | output_N1M | int | 0 | |
  809. | 12 | output_elempack | int | 0 | |
  810. | 13 | output_elemtype | int | 0 | |
  811. | 14 | output_transpose | int| 0 | |
  812. | 20 | constant_TILE_M | int | 0 | |
  813. | 21 | constant_TILE_N | int | 0 | |
  814. | 22 | constant_TILE_K | int | 0 | |
  815. | weight | type | shape |
  816. | ------------- | ----- | --------------------- |
  817. | A_data | float | [M, K] or [K, M] |
  818. | B_data | float | [N, K] or [K, N] |
  819. | C_data | float | [1], [M] or [N] or [1, M] or [N,1] or [N, M] |
  820. # GridSample
  821. ```
  822. Given an input and a flow-field grid, computes the output using input values and pixel locations from grid.
  823. For each output location output[:, h2, w2], the size-2 vector grid[h2, w2, 2] specifies input pixel[:, h1, w1] locations x and y,
  824. which are used to interpolate the output value output[:, h2, w2]
  825. This function is often used in conjunction with affine_grid() to build Spatial Transformer Networks .
  826. ```
  827. | param id | name | type | default | description |
  828. | --------- | ------------- | ----- | --------- | ----------------- |
  829. | 0 | sample_type | int | 1 | |
  830. | 1 | padding_mode | int | 1 | |
  831. | 2 | align_corner | int | 0 | |
  832. | 3 | permute_fusion| int | 0 | fuse with permute |
  833. Sample type:
  834. - 1 = Nearest
  835. - 2 = Bilinear
  836. - 3 = Bicubic
  837. Padding mode:
  838. - 1 = zeros
  839. - 2 = border
  840. - 3 = reflection
  841. # GroupNorm
  842. ```
  843. split x along channel axis into group x0, x1 ...
  844. l2 normalize for each group x0, x1 ...
  845. y = x * gamma + beta
  846. ```
  847. * one_blob_only
  848. * support_inplace
  849. | param id | name | type | default | description |
  850. | --------- | ------------- | ----- | --------- | ----------------- |
  851. | 0 | group | int | 1 | |
  852. | 1 | channels | int | 0 | |
  853. | 2 | eps | float | 0.001f | x = x / sqrt(var + eps) |
  854. | 3 | affine | int | 1 | |
  855. | weight | type | shape |
  856. | ------------- | ----- | --------------------- |
  857. | gamma_data | float | [channels] |
  858. | beta_data | float | [channels] |
  859. # GRU
  860. 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]`.
  861. ```
  862. y = gru(x)
  863. y0, hidden y1 = gru(x0, hidden x1)
  864. ```
  865. * one_blob_only if bidirectional
  866. | param id | name | type | default | description |
  867. | --------- | ------------- | ----- | --------- | ----------------- |
  868. | 0 | num_output | int | 0 | hidden size of output |
  869. | 1 | weight_data_size| int | 0 | total size of weight matrix |
  870. | 2 | direction | int | 0 | 0=forward, 1=reverse, 2=bidirectional |
  871. | weight | type | shape |
  872. | ------------- | ----- | --------------------- |
  873. | weight_xc_data| float/fp16/int8 | [input_size, num_output * 3, num_directions] |
  874. | bias_c_data | float/fp16/int8 | [num_output, 4, num_directions] |
  875. | weight_hc_data| float/fp16/int8 | [num_output, num_output * 3, num_directions] |
  876. Direction flag:
  877. - 0 = forward only
  878. - 1 = reverse only
  879. - 2 = bidirectional
  880. # HardSigmoid
  881. ```
  882. y = clamp(x * alpha + beta, 0, 1)
  883. ```
  884. * one_blob_only
  885. * support_inplace
  886. | param id | name | type | default | description |
  887. | --------- | ------------- | ----- | --------- | ----------------- |
  888. | 0 | alpha | float | 0.2f | |
  889. | 1 | beta | float | 0.5f | |
  890. # HardSwish
  891. ```
  892. y = x * clamp(x * alpha + beta, 0, 1)
  893. ```
  894. * one_blob_only
  895. * support_inplace
  896. | param id | name | type | default | description |
  897. | --------- | ------------- | ----- | --------- | ----------------- |
  898. | 0 | alpha | float | 0.2f | |
  899. | 1 | beta | float | 0.5f | |
  900. # InnerProduct
  901. ```
  902. x2 = innerproduct(x, weight) + bias
  903. y = activation(x2, act_type, act_params)
  904. ```
  905. * one_blob_only
  906. | param id | name | type | default | description |
  907. | --------- | ------------- | ----- | --------- | ----------------- |
  908. | 0 | num_output | int | 0 | |
  909. | 1 | bias_term | int | 0 | |
  910. | 2 | weight_data_size| int | 0 | |
  911. | 8 | int8_scale_term| int | 0 | |
  912. | 9 | activation_type| int | 0 | |
  913. | 10 | activation_params| array | [ ] | |
  914. | weight | type | shape |
  915. | ------------- | ----- | --------------------- |
  916. | weight_data | float/fp16/int8 | [num_input, num_output] |
  917. | bias_data | float | [num_output] |
  918. | weight_data_int8_scales| float | [num_output] |
  919. | bottom_blob_int8_scales| float | [1] |
  920. # Input
  921. ```
  922. y = input
  923. ```
  924. * support_inplace
  925. | param id | name | type | default | description |
  926. | --------- | ------------- | ----- | --------- | ----------------- |
  927. | 0 | w | int | 0 | |
  928. | 1 | h | int | 0 | |
  929. | 11 | d | int | 0 | |
  930. | 2 | c | int | 0 | |
  931. # InstanceNorm
  932. ```
  933. split x along channel axis into instance x0, x1 ...
  934. l2 normalize for each channel instance x0, x1 ...
  935. y = x * gamma + beta
  936. ```
  937. * one_blob_only
  938. * support_inplace
  939. | param id | name | type | default | description |
  940. | --------- | ------------- | ----- | --------- | ----------------- |
  941. | 0 | channels | int | 0 | |
  942. | 1 | eps | float | 0.001f | x = x / sqrt(var + eps) |
  943. | 2 | affine | int | 1 | |
  944. | weight | type | shape |
  945. | ------------- | ----- | --------------------- |
  946. | gamma_data | float | [channels] |
  947. | beta_data | float | [channels] |
  948. # Interp
  949. ```
  950. if dynamic_target_size == 0 y = resize(x) by fixed size or scale
  951. else y = resize(x0, size(x1))
  952. ```
  953. * one_blob_only if dynamic_target_size == 0
  954. | param id | name | type | default | description |
  955. | --------- | ------------- | ----- | --------- | ----------------- |
  956. | 0 | resize_type | int | 0 | |
  957. | 1 | height_scale | float | 1.f | |
  958. | 2 | width_scale | float | 1.f | |
  959. | 3 | output_height | int | 0 | |
  960. | 4 | output_width | int | 0 | |
  961. | 5 | dynamic_target_size| int | 0 | |
  962. | 6 | align_corner | int | 0 | |
  963. Resize type:
  964. - 1 = Nearest
  965. - 2 = Bilinear
  966. - 3 = Bicubic
  967. # LayerNorm
  968. ```
  969. split x along outmost axis into part x0, x1 ...
  970. l2 normalize for each part x0, x1 ...
  971. y = x * gamma + beta by elementwise
  972. ```
  973. * one_blob_only
  974. * support_inplace
  975. | param id | name | type | default | description |
  976. | --------- | ------------- | ----- | --------- | ----------------- |
  977. | 0 | affine_size | int | 0 | |
  978. | 1 | eps | float | 0.001f | x = x / sqrt(var + eps) |
  979. | 2 | affine | int | 1 | |
  980. | weight | type | shape |
  981. | ------------- | ----- | --------------------- |
  982. | gamma_data | float | [affine_size] |
  983. | beta_data | float | [affine_size] |
  984. # Log
  985. ```
  986. if base == -1 y = log(shift + x * scale)
  987. else y = log(shift + x * scale) / log(base)
  988. ```
  989. * one_blob_only
  990. * support_inplace
  991. | param id | name | type | default | description |
  992. | --------- | ------------- | ----- | --------- | ----------------- |
  993. | 0 | base | float | -1.f | |
  994. | 1 | scale | float | 1.f | |
  995. | 2 | shift | float | 0.f | |
  996. # LRN
  997. ```
  998. if region_type == ACROSS_CHANNELS square_sum = sum of channel window of local_size
  999. if region_type == WITHIN_CHANNEL square_sum = sum of spatial window of local_size
  1000. y = x * pow(bias + alpha * square_sum / (local_size * local_size), -beta)
  1001. ```
  1002. * one_blob_only
  1003. * support_inplace
  1004. | param id | name | type | default | description |
  1005. | --------- | ------------- | ----- | --------- | ----------------- |
  1006. | 0 | region_type | int | 0 | |
  1007. | 1 | local_size | int | 5 | |
  1008. | 2 | alpha | float | 1.f | |
  1009. | 3 | beta | float | 0.75f | |
  1010. | 4 | bias | float | 1.f | |
  1011. Region type:
  1012. - 0 = ACROSS_CHANNELS
  1013. - 1 = WITHIN_CHANNEL
  1014. # LSTM
  1015. 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]`.
  1016. ```
  1017. y = lstm(x)
  1018. y0, hidden y1, cell y2 = lstm(x0, hidden x1, cell x2)
  1019. ```
  1020. * one_blob_only if bidirectional
  1021. | param id | name | type | default | description |
  1022. | --------- | ------------- | ----- | --------- | ----------------- |
  1023. | 0 | num_output | int | 0 | output size of output |
  1024. | 1 | weight_data_size| int | 0 | total size of IFOG weight matrix |
  1025. | 2 | direction | int | 0 | 0=forward, 1=reverse, 2=bidirectional |
  1026. | 3 | hidden_size | int | num_output| hidden size |
  1027. | weight | type | shape |
  1028. | ------------- | ----- | --------------------- |
  1029. | weight_xc_data| float/fp16/int8 | [input_size, hidden_size * 4, num_directions] |
  1030. | bias_c_data | float/fp16/int8 | [hidden_size, 4, num_directions] |
  1031. | weight_hc_data| float/fp16/int8 | [num_output, hidden_size * 4, num_directions] |
  1032. | weight_hr_data| float/fp16/int8 | [hidden_size, num_output, num_directions] |
  1033. Direction flag:
  1034. - 0 = forward only
  1035. - 1 = reverse only
  1036. - 2 = bidirectional
  1037. # MemoryData
  1038. ```
  1039. y = data
  1040. ```
  1041. | param id | name | type | default | description |
  1042. | --------- | ------------- | ----- | --------- | ----------------- |
  1043. | 0 | w | int | 0 | |
  1044. | 1 | h | int | 0 | |
  1045. | 11 | d | int | 0 | |
  1046. | 2 | c | int | 0 | |
  1047. | 21 | load_type | int | 1 | 1=fp32 |
  1048. | weight | type | shape |
  1049. | ------------- | ----- | --------------------- |
  1050. | data | float | [w, h, d, c] |
  1051. # Mish
  1052. ```
  1053. y = x * tanh(log(exp(x) + 1))
  1054. ```
  1055. * one_blob_only
  1056. * support_inplace
  1057. # MultiHeadAttention
  1058. ```
  1059. split q k v into num_head part q0, k0, v0, q1, k1, v1 ...
  1060. for each num_head part
  1061. xq = affine(q) / (embed_dim / num_head)
  1062. xk = affine(k)
  1063. xv = affine(v)
  1064. xqk = xq * xk
  1065. xqk = xqk + attn_mask if attn_mask exists
  1066. softmax_inplace(xqk)
  1067. xqkv = xqk * xv
  1068. merge xqkv to out
  1069. y = affine(out)
  1070. ```
  1071. | param id | name | type | default | description |
  1072. | --------- | ------------- | ----- | --------- | ----------------- |
  1073. | 0 | embed_dim | int | 0 | |
  1074. | 1 | num_heads | int | 1 | |
  1075. | 2 | weight_data_size| int | 0 | qdim = weight_data_size / embed_dim |
  1076. | 3 | kdim | int | embed_dim | |
  1077. | 4 | vdim | int | embed_dim | |
  1078. | 5 | attn_mask | int | 0 | |
  1079. | 6 | scale | float | 1.f / sqrt(embed_dim / num_heads) | |
  1080. | weight | type | shape |
  1081. | ------------- | ----- | --------------------- |
  1082. | q_weight_data | float/fp16/int8 | [embed_dim * qdim] |
  1083. | q_bias_data | float | [embed_dim] |
  1084. | k_weight_data | float/fp16/int8 | [embed_dim * kdim] |
  1085. | k_bias_data | float | [embed_dim] |
  1086. | v_weight_data | float/fp16/int8 | [embed_dim * vdim] |
  1087. | v_bias_data | float | [embed_dim] |
  1088. | out_weight_data| float/fp16/int8 | [qdim * embed_dim] |
  1089. | out_bias_data | float | [qdim] |
  1090. # MVN
  1091. ```
  1092. if normalize_variance == 1 && across_channels == 1 y = (x - mean) / (sqrt(var) + eps) of whole blob
  1093. if normalize_variance == 1 && across_channels == 0 y = (x - mean) / (sqrt(var) + eps) of each channel
  1094. if normalize_variance == 0 && across_channels == 1 y = x - mean of whole blob
  1095. if normalize_variance == 0 && across_channels == 0 y = x - mean of each channel
  1096. ```
  1097. * one_blob_only
  1098. | param id | name | type | default | description |
  1099. | --------- | ------------- | ----- | --------- | ----------------- |
  1100. | 0 | normalize_variance| int | 0 | |
  1101. | 1 | across_channels| int | 0 | |
  1102. | 2 | eps | float | 0.0001f | x = x / (sqrt(var) + eps) |
  1103. # Noop
  1104. ```
  1105. y = x
  1106. ```
  1107. # Normalize
  1108. ```
  1109. if across_spatial == 1 && across_channel == 1 x2 = normalize(x) of whole blob
  1110. if across_spatial == 1 && across_channel == 0 x2 = normalize(x) of each channel
  1111. if across_spatial == 0 && across_channel == 1 x2 = normalize(x) of each position
  1112. y = x2 * scale
  1113. ```
  1114. * one_blob_only
  1115. * support_inplace
  1116. | param id | name | type | default | description |
  1117. | --------- | ------------- | ----- | --------- | ----------------- |
  1118. | 0 | across_spatial| int | 0 | |
  1119. | 1 | channel_shared| int | 0 | |
  1120. | 2 | eps | float | 0.0001f | see eps mode |
  1121. | 3 | scale_data_size| int | 0 | |
  1122. | 4 | across_channel| int | 0 | |
  1123. | 9 | eps_mode | int | 0 | |
  1124. | weight | type | shape |
  1125. | ------------- | ----- | --------------------- |
  1126. | scale_data | float | [scale_data_size] |
  1127. Eps Mode:
  1128. - 0 = caffe/mxnet x = x / sqrt(var + eps)
  1129. - 1 = pytorch x = x / max(sqrt(var), eps)
  1130. - 2 = tensorflow x = x / sqrt(max(var, eps))
  1131. # Packing
  1132. ```
  1133. y = wrap_packing(x)
  1134. ```
  1135. * one_blob_only
  1136. | param id | name | type | default | description |
  1137. | --------- | ------------- | ----- | --------- | ----------------- |
  1138. | 0 | out_elempack | int | 1 | |
  1139. | 1 | use_padding | int | 0 | |
  1140. | 2 | cast_type_from| int | 0 | |
  1141. | 3 | cast_type_to | int | 0 | |
  1142. | 4 | storage_type_from| int | 0 | |
  1143. | 5 | storage_type_to| int | 0 | |
  1144. # Padding
  1145. ```
  1146. y = pad(x, pads)
  1147. ```
  1148. | param id | name | type | default | description |
  1149. | --------- | ------------- | ---- | --------- | ----------------- |
  1150. | 0 | top | int | 0 | |
  1151. | 1 | bottom | int | 0 | |
  1152. | 2 | left | int | 0 | |
  1153. | 3 | right | int | 0 | |
  1154. | 4 | type | int | 0 | |
  1155. | 5 | value | float | 0 | |
  1156. | 6 | per_channel_pad_data_size| int | 0 | |
  1157. | 7 | front | int | stride_w | |
  1158. | 8 | behind | int | pad_left | |
  1159. | weight | type | shape |
  1160. | ------------- | ----- | --------------------- |
  1161. | per_channel_pad_data| float | [per_channel_pad_data_size] |
  1162. Padding type:
  1163. - 0 = CONSTANT
  1164. - 1 = REPLICATE
  1165. - 2 = REFLECT
  1166. # Permute
  1167. ```
  1168. y = reorder(x)
  1169. ```
  1170. | param id | name | type | default | description |
  1171. | --------- | ------------- | ---- | --------- | ----------------- |
  1172. | 0 | order_type | int | 0 | |
  1173. Order Type:
  1174. - 0 = WH WHC WHDC
  1175. - 1 = HW HWC HWDC
  1176. - 2 = WCH WDHC
  1177. - 3 = CWH DWHC
  1178. - 4 = HCW HDWC
  1179. - 5 = CHW DHWC
  1180. - 6 = WHCD
  1181. - 7 = HWCD
  1182. - 8 = WCHD
  1183. - 9 = CWHD
  1184. - 10 = HCWD
  1185. - 11 = CHWD
  1186. - 12 = WDCH
  1187. - 13 = DWCH
  1188. - 14 = WCDH
  1189. - 15 = CWDH
  1190. - 16 = DCWH
  1191. - 17 = CDWH
  1192. - 18 = HDCW
  1193. - 19 = DHCW
  1194. - 20 = HCDW
  1195. - 21 = CHDW
  1196. - 22 = DCHW
  1197. - 23 = CDHW
  1198. # PixelShuffle
  1199. ```
  1200. if mode == 0 y = depth_to_space(x) where x channel order is sw-sh-outc
  1201. if mode == 1 y = depth_to_space(x) where x channel order is outc-sw-sh
  1202. ```
  1203. * one_blob_only
  1204. | param id | name | type | default | description |
  1205. | --------- | ------------- | ---- | --------- | ----------------- |
  1206. | 0 | upscale_factor| int | 1 | |
  1207. | 1 | mode | int | 0 | |
  1208. # Pooling
  1209. ```
  1210. x2 = pad(x, pads)
  1211. x3 = pooling(x2, kernel, stride)
  1212. ```
  1213. | param id | name | type | default | description |
  1214. | --------- | --------------| ---- | --------- | ----------------- |
  1215. | 0 | pooling_type | int | 0 | |
  1216. | 1 | kernel_w | int | 0 | |
  1217. | 2 | stride_w | int | 1 | |
  1218. | 3 | pad_left | int | 0 | |
  1219. | 4 | global_pooling| int | 0 | |
  1220. | 5 | pad_mode | int | 0 | |
  1221. | 6 | avgpool_count_include_pad| int | 0 | |
  1222. | 7 | adaptive_pooling| int | 0 | |
  1223. | 8 | out_w | int | 0 | |
  1224. | 11 | kernel_h | int | kernel_w | |
  1225. | 12 | stride_h | int | stride_w | |
  1226. | 13 | pad_top | int | pad_left | |
  1227. | 14 | pad_right | int | pad_left | |
  1228. | 15 | pad_bottom | int | pad_top | |
  1229. | 18 | out_h | int | out_w | |
  1230. Pooling type:
  1231. - 0 = MAX
  1232. - 1 = AVG
  1233. Pad mode:
  1234. - 0 = full padding
  1235. - 1 = valid padding
  1236. - 2 = tensorflow padding=SAME or onnx padding=SAME_UPPER
  1237. - 3 = onnx padding=SAME_LOWER
  1238. # Pooling1D
  1239. ```
  1240. x2 = pad(x, pads)
  1241. x3 = pooling1d(x2, kernel, stride)
  1242. ```
  1243. | param id | name | type | default | description |
  1244. | --------- | --------------| ---- | --------- | ----------------- |
  1245. | 0 | pooling_type | int | 0 | |
  1246. | 1 | kernel_w | int | 0 | |
  1247. | 2 | stride_w | int | 1 | |
  1248. | 3 | pad_left | int | 0 | |
  1249. | 4 | global_pooling| int | 0 | |
  1250. | 5 | pad_mode | int | 0 | |
  1251. | 6 | avgpool_count_include_pad| int | 0 | |
  1252. | 7 | adaptive_pooling| int | 0 | |
  1253. | 8 | out_w | int | 0 | |
  1254. | 14 | pad_right | int | pad_left | |
  1255. Pooling type:
  1256. - 0 = MAX
  1257. - 1 = AVG
  1258. Pad mode:
  1259. - 0 = full padding
  1260. - 1 = valid padding
  1261. - 2 = tensorflow padding=SAME or onnx padding=SAME_UPPER
  1262. - 3 = onnx padding=SAME_LOWER
  1263. # Pooling3D
  1264. ```
  1265. x2 = pad(x, pads)
  1266. x3 = pooling3d(x2, kernel, stride)
  1267. ```
  1268. | param id | name | type | default | description |
  1269. | --------- | --------------| ---- | --------- | ----------------- |
  1270. | 0 | pooling_type | int | 0 | |
  1271. | 1 | kernel_w | int | 0 | |
  1272. | 2 | stride_w | int | 1 | |
  1273. | 3 | pad_left | int | 0 | |
  1274. | 4 | global_pooling| int | 0 | |
  1275. | 5 | pad_mode | int | 0 | |
  1276. | 6 | avgpool_count_include_pad| int | 0 | |
  1277. | 7 | adaptive_pooling| int | 0 | |
  1278. | 8 | out_w | int | 0 | |
  1279. | 11 | kernel_h | int | kernel_w | |
  1280. | 12 | stride_h | int | stride_w | |
  1281. | 13 | pad_top | int | pad_left | |
  1282. | 14 | pad_right | int | pad_left | |
  1283. | 15 | pad_bottom | int | pad_top | |
  1284. | 16 | pad_behind | int | pad_front | |
  1285. | 18 | out_h | int | out_w | |
  1286. | 21 | kernel_d | int | kernel_w | |
  1287. | 22 | stride_d | int | stride_w | |
  1288. | 23 | pad_front | int | pad_left | |
  1289. | 28 | out_d | int | out_w | |
  1290. Pooling type:
  1291. - 0 = MAX
  1292. - 1 = AVG
  1293. Pad mode:
  1294. - 0 = full padding
  1295. - 1 = valid padding
  1296. - 2 = tensorflow padding=SAME or onnx padding=SAME_UPPER
  1297. - 3 = onnx padding=SAME_LOWER
  1298. # Power
  1299. ```
  1300. y = pow((shift + x * scale), power)
  1301. ```
  1302. * one_blob_only
  1303. * support_inplace
  1304. | param id | name | type | default | description |
  1305. | --------- | ------------- | ----- | --------- | ----------------- |
  1306. | 0 | power | float | 1.f | |
  1307. | 1 | scale | float | 1.f | |
  1308. | 2 | shift | float | 0.f | |
  1309. # PReLU
  1310. ```
  1311. if x < 0 y = x * slope
  1312. else y = x
  1313. ```
  1314. * one_blob_only
  1315. * support_inplace
  1316. | param id | name | type | default | description |
  1317. | --------- | ------------- | ----- | --------- | ----------------- |
  1318. | 0 | num_slope | int | 0 | |
  1319. | weight | type | shape |
  1320. | ------------- | ----- | --------------------- |
  1321. | slope_data | float | [num_slope] |
  1322. # Quantize
  1323. ```
  1324. y = float2int8(x * scale)
  1325. ```
  1326. * one_blob_only
  1327. | param id | name | type | default | description |
  1328. | --------- | ------------- | ----- | --------- | ----------------- |
  1329. | 0 | scale_data_size| int | 1 | |
  1330. | weight | type | shape |
  1331. | ------------- | ----- | --------------------- |
  1332. | scale_data | float | [scale_data_size] |
  1333. # Reduction
  1334. ```
  1335. y = reduce_op(x * coeff)
  1336. ```
  1337. * one_blob_only
  1338. | param id | name | type | default | description |
  1339. | --------- | ------------- | ----- | --------- | ----------------- |
  1340. | 0 | operation | int | 0 | |
  1341. | 1 | reduce_all | int | 1 | |
  1342. | 2 | coeff | float | 1.f | |
  1343. | 3 | axes | array | [ ] | |
  1344. | 4 | keepdims | int | 0 | |
  1345. | 5 | fixbug0 | int | 0 | hack for bug fix, should be 1 |
  1346. Operation type:
  1347. - 0 = SUM
  1348. - 1 = ASUM
  1349. - 2 = SUMSQ
  1350. - 3 = MEAN
  1351. - 4 = MAX
  1352. - 5 = MIN
  1353. - 6 = PROD
  1354. - 7 = L1
  1355. - 8 = L2
  1356. - 9 = LogSum
  1357. - 10 = LogSumExp
  1358. # ReLU
  1359. ```
  1360. if x < 0 y = x * slope
  1361. else y = x
  1362. ```
  1363. * one_blob_only
  1364. * support_inplace
  1365. | param id | name | type | default | description |
  1366. | --------- | ------------- | ----- | --------- | ----------------- |
  1367. | 0 | slope | float | 0.f | |
  1368. # Reorg
  1369. ```
  1370. if mode == 0 y = space_to_depth(x) where x channel order is sw-sh-outc
  1371. if mode == 1 y = space_to_depth(x) where x channel order is outc-sw-sh
  1372. ```
  1373. * one_blob_only
  1374. | param id | name | type | default | description |
  1375. | --------- | ------------- | ---- | --------- | ----------------- |
  1376. | 0 | stride | int | 1 | |
  1377. | 1 | mode | int | 0 | |
  1378. # Requantize
  1379. ```
  1380. x2 = x * scale_in + bias
  1381. x3 = activation(x2)
  1382. y = float2int8(x3 * scale_out)
  1383. ```
  1384. * one_blob_only
  1385. | param id | name | type | default | description |
  1386. | --------- | ------------- | ----- | --------- | ----------------- |
  1387. | 0 | scale_in_data_size| int | 1 | |
  1388. | 1 | scale_out_data_size| int | 1 | |
  1389. | 2 | bias_data_size| int | 0 | |
  1390. | 3 | activation_type| int | 0 | |
  1391. | 4 | activation_params| int | [ ] | |
  1392. | weight | type | shape |
  1393. | ------------- | ----- | --------------------- |
  1394. | scale_in_data | float | [scale_in_data_size] |
  1395. | scale_out_data| float | [scale_out_data_size] |
  1396. | bias_data | float | [bias_data_size] |
  1397. # Reshape
  1398. ```
  1399. if permute == 1 y = hwc2chw(reshape(chw2hwc(x)))
  1400. else y = reshape(x)
  1401. ```
  1402. * one_blob_only
  1403. | param id | name | type | default | description |
  1404. | --------- | ------------- | ----- | --------- | ----------------- |
  1405. | 0 | w | int | -233 | |
  1406. | 1 | h | int | -233 | |
  1407. | 11 | d | int | -233 | |
  1408. | 2 | c | int | -233 | |
  1409. | 3 | permute | int | 0 | |
  1410. Reshape flag:
  1411. - 0 = copy from bottom
  1412. - -1 = remaining
  1413. - -233 = drop this dim(default)
  1414. # RMSNorm
  1415. ```
  1416. split x along outmost axis into part x0, x1 ...
  1417. root mean square normalize for each part x0, x1 ...
  1418. y = x * gamma by elementwise
  1419. ```
  1420. * one_blob_only
  1421. * support_inplace
  1422. | param id | name | type | default | description |
  1423. | --------- | ------------- | ----- | --------- | ----------------- |
  1424. | 0 | affine_size | int | 0 | |
  1425. | 1 | eps | float | 0.001f | x = x / sqrt(var + eps) |
  1426. | 2 | affine | int | 1 | |
  1427. | weight | type | shape |
  1428. | ------------- | ----- | --------------------- |
  1429. | gamma_data | float | [affine_size] |
  1430. # RNN
  1431. 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]`.
  1432. ```
  1433. y = rnn(x)
  1434. y0, hidden y1 = rnn(x0, hidden x1)
  1435. ```
  1436. * one_blob_only if bidirectional
  1437. | param id | name | type | default | description |
  1438. | --------- | ------------- | ----- | --------- | ----------------- |
  1439. | 0 | num_output | int | 0 | hidden size of output |
  1440. | 1 | weight_data_size| int | 0 | total size of weight matrix |
  1441. | 2 | direction | int | 0 | 0=forward, 1=reverse, 2=bidirectional |
  1442. | weight | type | shape |
  1443. | ------------- | ----- | --------------------- |
  1444. | weight_xc_data| float/fp16/int8 | [input_size, num_output, num_directions] |
  1445. | bias_c_data | float/fp16/int8 | [num_output, 1, num_directions] |
  1446. | weight_hc_data| float/fp16/int8 | [num_output, num_output, num_directions] |
  1447. Direction flag:
  1448. - 0 = forward only
  1449. - 1 = reverse only
  1450. - 2 = bidirectional
  1451. # Scale
  1452. ```
  1453. if scale_data_size == -233 y = x0 * x1
  1454. else y = x * scale + bias
  1455. ```
  1456. * one_blob_only if scale_data_size != -233
  1457. * support_inplace
  1458. | param id | name | type | default | description |
  1459. | --------- | ------------- | ----- | --------- | ----------------- |
  1460. | 0 | scale_data_size| int | 0 | |
  1461. | 1 | bias_term | int | 0 | |
  1462. | weight | type | shape |
  1463. | ------------- | ----- | --------------------- |
  1464. | scale_data | float | [scale_data_size] |
  1465. | bias_data | float | [scale_data_size] |
  1466. # SELU
  1467. ```
  1468. if x < 0 y = (exp(x) - 1.f) * alpha * lambda
  1469. else y = x * lambda
  1470. ```
  1471. * one_blob_only
  1472. * support_inplace
  1473. | param id | name | type | default | description |
  1474. | --------- | ------------- | ----- | --------- | ----------------- |
  1475. | 0 | alpha | float | 1.67326324f| |
  1476. | 1 | lambda | float | 1.050700987f| |
  1477. # Shrink
  1478. ```
  1479. if x < -lambd y = x + bias
  1480. if x > lambd y = x - bias
  1481. else y = x
  1482. ```
  1483. * one_blob_only
  1484. * support_inplace
  1485. | param id | name | type | default | description |
  1486. | --------- | ------------- | ----- | --------- | ----------------- |
  1487. | 0 | bias | float | 0.0f | |
  1488. | 1 | lambd | float | 0.5f | |
  1489. # ShuffleChannel
  1490. ```
  1491. if reverse == 0 y = shufflechannel(x) by group
  1492. if reverse == 1 y = shufflechannel(x) by channel / group
  1493. ```
  1494. * one_blob_only
  1495. | param id | name | type | default | description |
  1496. | --------- | ------------- | ---- | --------- | ----------------- |
  1497. | 0 | group | int | 1 | |
  1498. | 1 | reverse | int | 0 | |
  1499. # Sigmoid
  1500. ```
  1501. y = 1 / (1 + exp(-x))
  1502. ```
  1503. * one_blob_only
  1504. * support_inplace
  1505. # Slice
  1506. ```
  1507. split x along axis into slices, each part slice size is based on slices array
  1508. ```
  1509. | param id | name | type | default | description |
  1510. | --------- | ------------- | ----- | --------- | ----------------- |
  1511. | 0 | slices | array | [ ] | |
  1512. | 1 | axis | int | 0 | |
  1513. | 2 | indices | array | [ ] | |
  1514. # Softmax
  1515. ```
  1516. softmax(x, axis)
  1517. ```
  1518. * one_blob_only
  1519. * support_inplace
  1520. | param id | name | type | default | description |
  1521. | --------- | ------------- | ----- | --------- | ----------------- |
  1522. | 0 | axis | int | 0 | |
  1523. | 1 | fixbug0 | int | 0 | hack for bug fix, should be 1 |
  1524. # Softplus
  1525. ```
  1526. y = log(exp(x) + 1)
  1527. ```
  1528. * one_blob_only
  1529. * support_inplace
  1530. # Split
  1531. ```
  1532. y0, y1 ... = x
  1533. ```
  1534. # Swish
  1535. ```
  1536. y = x / (1 + exp(-x))
  1537. ```
  1538. * one_blob_only
  1539. * support_inplace
  1540. # TanH
  1541. ```
  1542. y = tanh(x)
  1543. ```
  1544. * one_blob_only
  1545. * support_inplace
  1546. # Threshold
  1547. ```
  1548. if x > threshold y = 1
  1549. else y = 0
  1550. ```
  1551. * one_blob_only
  1552. * support_inplace
  1553. | param id | name | type | default | description |
  1554. | --------- | ------------- | ----- | --------- | ----------------- |
  1555. | 0 | threshold | float | 0.f | |
  1556. # Tile
  1557. ```
  1558. y = repeat tiles along axis for x
  1559. ```
  1560. * one_blob_only
  1561. | param id | name | type | default | description |
  1562. | --------- | ------------- | ----- | --------- | ----------------- |
  1563. | 0 | axis | int | 0 | |
  1564. | 1 | tiles | int | 1 | |
  1565. | 2 | repeats | array | [ ] | |
  1566. # UnaryOp
  1567. ```
  1568. y = unaryop(x)
  1569. ```
  1570. - one_blob_only
  1571. - support_inplace
  1572. | param id | name | type | default | description |
  1573. | --------- | ------------- | ----- | --------- | ----------------- |
  1574. | 0 | op_type | int | 0 | Operation type as follows |
  1575. Operation type:
  1576. - 0 = ABS
  1577. - 1 = NEG
  1578. - 2 = FLOOR
  1579. - 3 = CEIL
  1580. - 4 = SQUARE
  1581. - 5 = SQRT
  1582. - 6 = RSQ
  1583. - 7 = EXP
  1584. - 8 = LOG
  1585. - 9 = SIN
  1586. - 10 = COS
  1587. - 11 = TAN
  1588. - 12 = ASIN
  1589. - 13 = ACOS
  1590. - 14 = ATAN
  1591. - 15 = RECIPROCAL
  1592. - 16 = TANH
  1593. - 17 = LOG10
  1594. - 18 = ROUND
  1595. - 19 = TRUNC
  1596. # Unfold
  1597. ```
  1598. y = unfold(x)
  1599. ```
  1600. * one_blob_only
  1601. | param id | name | type | default | description |
  1602. | --------- | ------------- | ----- | --------- | ----------------- |
  1603. | 0 | num_output | int | 0 | |
  1604. | 1 | kernel_w | int | 0 | |
  1605. | 2 | dilation_w | int | 1 | |
  1606. | 3 | stride_w | int | 1 | |
  1607. | 4 | pad_left | int | 0 | |
  1608. | 11 | kernel_h | int | kernel_w | |
  1609. | 12 | dilation_h | int | dilation_w | |
  1610. | 13 | stride_h | int | stride_w | |
  1611. | 14 | pad_top | int | pad_left | |
  1612. | 15 | pad_right | int | pad_left | |
  1613. | 16 | pad_bottom | int | pad_top | |