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 75 kB

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