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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986
  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. | 9 | size_expr | str | "" | |
  972. Resize type:
  973. - 1 = Nearest
  974. - 2 = Bilinear
  975. - 3 = Bicubic
  976. # InverseSpectrogram
  977. ```
  978. x1 = x as complex
  979. x1 = x1 * sqrt(norm) if normalized
  980. y = istft(x1)
  981. y1 = unpad(y) if center
  982. if returns == 0 return y1 as complex
  983. if returns == 1 return y1 real
  984. if returns == 2 return y1 imag
  985. ```
  986. * one_blob_only
  987. | param id | name | type | default | description |
  988. | --------- | ------------- | ----- | --------- | ----------------- |
  989. | 0 | n_fft | int | 0 | |
  990. | 1 | returns | int | 1 | |
  991. | 2 | hoplen | int | n_fft / 4 | |
  992. | 3 | winlen | int | n_fft | |
  993. | 4 | window_type | int | 0 | 0=ones 1=hann 2=hamming |
  994. | 5 | center | int | 1 | |
  995. | 7 | normalized | int | 0 | 0=no 1=n_fft 2=window-l2-energy |
  996. # LayerNorm
  997. ```
  998. split x along outmost axis into part x0, x1 ...
  999. l2 normalize for each part x0, x1 ...
  1000. y = x * gamma + beta by elementwise
  1001. ```
  1002. * one_blob_only
  1003. * support_inplace
  1004. | param id | name | type | default | description |
  1005. | --------- | ------------- | ----- | --------- | ----------------- |
  1006. | 0 | affine_size | int | 0 | |
  1007. | 1 | eps | float | 0.001f | x = x / sqrt(var + eps) |
  1008. | 2 | affine | int | 1 | |
  1009. | weight | type | shape |
  1010. | ------------- | ----- | --------------------- |
  1011. | gamma_data | float | [affine_size] |
  1012. | beta_data | float | [affine_size] |
  1013. # Log
  1014. ```
  1015. if base == -1 y = log(shift + x * scale)
  1016. else y = log(shift + x * scale) / log(base)
  1017. ```
  1018. * one_blob_only
  1019. * support_inplace
  1020. | param id | name | type | default | description |
  1021. | --------- | ------------- | ----- | --------- | ----------------- |
  1022. | 0 | base | float | -1.f | |
  1023. | 1 | scale | float | 1.f | |
  1024. | 2 | shift | float | 0.f | |
  1025. # LRN
  1026. ```
  1027. if region_type == ACROSS_CHANNELS square_sum = sum of channel window of local_size
  1028. if region_type == WITHIN_CHANNEL square_sum = sum of spatial window of local_size
  1029. y = x * pow(bias + alpha * square_sum / (local_size * local_size), -beta)
  1030. ```
  1031. * one_blob_only
  1032. * support_inplace
  1033. | param id | name | type | default | description |
  1034. | --------- | ------------- | ----- | --------- | ----------------- |
  1035. | 0 | region_type | int | 0 | |
  1036. | 1 | local_size | int | 5 | |
  1037. | 2 | alpha | float | 1.f | |
  1038. | 3 | beta | float | 0.75f | |
  1039. | 4 | bias | float | 1.f | |
  1040. Region type:
  1041. - 0 = ACROSS_CHANNELS
  1042. - 1 = WITHIN_CHANNEL
  1043. # LSTM
  1044. 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]`.
  1045. ```
  1046. y = lstm(x)
  1047. y0, hidden y1, cell y2 = lstm(x0, hidden x1, cell x2)
  1048. ```
  1049. * one_blob_only if bidirectional
  1050. | param id | name | type | default | description |
  1051. | --------- | ------------- | ----- | --------- | ----------------- |
  1052. | 0 | num_output | int | 0 | output size of output |
  1053. | 1 | weight_data_size| int | 0 | total size of IFOG weight matrix |
  1054. | 2 | direction | int | 0 | 0=forward, 1=reverse, 2=bidirectional |
  1055. | 3 | hidden_size | int | num_output| hidden size |
  1056. | weight | type | shape |
  1057. | ------------- | ----- | --------------------- |
  1058. | weight_xc_data| float/fp16/int8 | [input_size, hidden_size * 4, num_directions] |
  1059. | bias_c_data | float/fp16/int8 | [hidden_size, 4, num_directions] |
  1060. | weight_hc_data| float/fp16/int8 | [num_output, hidden_size * 4, num_directions] |
  1061. | weight_hr_data| float/fp16/int8 | [hidden_size, num_output, num_directions] |
  1062. Direction flag:
  1063. - 0 = forward only
  1064. - 1 = reverse only
  1065. - 2 = bidirectional
  1066. # MemoryData
  1067. ```
  1068. y = data
  1069. ```
  1070. | param id | name | type | default | description |
  1071. | --------- | ------------- | ----- | --------- | ----------------- |
  1072. | 0 | w | int | 0 | |
  1073. | 1 | h | int | 0 | |
  1074. | 11 | d | int | 0 | |
  1075. | 2 | c | int | 0 | |
  1076. | 21 | load_type | int | 1 | 1=fp32 |
  1077. | weight | type | shape |
  1078. | ------------- | ----- | --------------------- |
  1079. | data | float | [w, h, d, c] |
  1080. # Mish
  1081. ```
  1082. y = x * tanh(log(exp(x) + 1))
  1083. ```
  1084. * one_blob_only
  1085. * support_inplace
  1086. # MultiHeadAttention
  1087. ```
  1088. split q k v into num_head part q0, k0, v0, q1, k1, v1 ...
  1089. for each num_head part
  1090. xq = affine(q) / (embed_dim / num_head)
  1091. xk = affine(k)
  1092. xv = affine(v)
  1093. xqk = xq * xk
  1094. xqk = xqk + attn_mask if attn_mask exists
  1095. softmax_inplace(xqk)
  1096. xqkv = xqk * xv
  1097. merge xqkv to out
  1098. y = affine(out)
  1099. ```
  1100. | param id | name | type | default | description |
  1101. | --------- | ------------- | ----- | --------- | ----------------- |
  1102. | 0 | embed_dim | int | 0 | |
  1103. | 1 | num_heads | int | 1 | |
  1104. | 2 | weight_data_size| int | 0 | qdim = weight_data_size / embed_dim |
  1105. | 3 | kdim | int | embed_dim | |
  1106. | 4 | vdim | int | embed_dim | |
  1107. | 5 | attn_mask | int | 0 | |
  1108. | 6 | scale | float | 1.f / sqrt(embed_dim / num_heads) | |
  1109. | 18 | int8_scale_term | int | 0 | |
  1110. | weight | type | shape |
  1111. | ------------- | ----- | --------------------- |
  1112. | q_weight_data | float/fp16/int8 | [embed_dim * qdim] |
  1113. | q_bias_data | float | [embed_dim] |
  1114. | k_weight_data | float/fp16/int8 | [embed_dim * kdim] |
  1115. | k_bias_data | float | [embed_dim] |
  1116. | v_weight_data | float/fp16/int8 | [embed_dim * vdim] |
  1117. | v_bias_data | float | [embed_dim] |
  1118. | out_weight_data| float/fp16/int8 | [qdim * embed_dim] |
  1119. | out_bias_data | float | [qdim] |
  1120. | q_weight_data_int8_scales| float | [embed_dim] |
  1121. | k_weight_data_int8_scales| float | [embed_dim] |
  1122. | v_weight_data_int8_scales| float | [embed_dim] |
  1123. | out_weight_data_int8_scales| float | [1] |
  1124. # MVN
  1125. ```
  1126. if normalize_variance == 1 && across_channels == 1 y = (x - mean) / (sqrt(var) + eps) of whole blob
  1127. if normalize_variance == 1 && across_channels == 0 y = (x - mean) / (sqrt(var) + eps) of each channel
  1128. if normalize_variance == 0 && across_channels == 1 y = x - mean of whole blob
  1129. if normalize_variance == 0 && across_channels == 0 y = x - mean of each channel
  1130. ```
  1131. * one_blob_only
  1132. | param id | name | type | default | description |
  1133. | --------- | ------------- | ----- | --------- | ----------------- |
  1134. | 0 | normalize_variance| int | 0 | |
  1135. | 1 | across_channels| int | 0 | |
  1136. | 2 | eps | float | 0.0001f | x = x / (sqrt(var) + eps) |
  1137. # Noop
  1138. ```
  1139. y = x
  1140. ```
  1141. # Normalize
  1142. ```
  1143. if across_spatial == 1 && across_channel == 1 x2 = normalize(x) of whole blob
  1144. if across_spatial == 1 && across_channel == 0 x2 = normalize(x) of each channel
  1145. if across_spatial == 0 && across_channel == 1 x2 = normalize(x) of each position
  1146. y = x2 * scale
  1147. ```
  1148. * one_blob_only
  1149. * support_inplace
  1150. | param id | name | type | default | description |
  1151. | --------- | ------------- | ----- | --------- | ----------------- |
  1152. | 0 | across_spatial| int | 0 | |
  1153. | 1 | channel_shared| int | 0 | |
  1154. | 2 | eps | float | 0.0001f | see eps mode |
  1155. | 3 | scale_data_size| int | 0 | |
  1156. | 4 | across_channel| int | 0 | |
  1157. | 9 | eps_mode | int | 0 | |
  1158. | weight | type | shape |
  1159. | ------------- | ----- | --------------------- |
  1160. | scale_data | float | [scale_data_size] |
  1161. Eps Mode:
  1162. - 0 = caffe/mxnet x = x / sqrt(var + eps)
  1163. - 1 = pytorch x = x / max(sqrt(var), eps)
  1164. - 2 = tensorflow x = x / sqrt(max(var, eps))
  1165. # Packing
  1166. ```
  1167. y = wrap_packing(x)
  1168. ```
  1169. * one_blob_only
  1170. | param id | name | type | default | description |
  1171. | --------- | ------------- | ----- | --------- | ----------------- |
  1172. | 0 | out_elempack | int | 1 | |
  1173. | 1 | use_padding | int | 0 | |
  1174. | 2 | cast_type_from| int | 0 | |
  1175. | 3 | cast_type_to | int | 0 | |
  1176. | 4 | storage_type_from| int | 0 | |
  1177. | 5 | storage_type_to| int | 0 | |
  1178. # Padding
  1179. ```
  1180. y = pad(x, pads)
  1181. ```
  1182. | param id | name | type | default | description |
  1183. | --------- | ------------- | ---- | --------- | ----------------- |
  1184. | 0 | top | int | 0 | |
  1185. | 1 | bottom | int | 0 | |
  1186. | 2 | left | int | 0 | |
  1187. | 3 | right | int | 0 | |
  1188. | 4 | type | int | 0 | |
  1189. | 5 | value | float | 0 | |
  1190. | 6 | per_channel_pad_data_size| int | 0 | |
  1191. | 7 | front | int | stride_w | |
  1192. | 8 | behind | int | pad_left | |
  1193. | weight | type | shape |
  1194. | ------------- | ----- | --------------------- |
  1195. | per_channel_pad_data| float | [per_channel_pad_data_size] |
  1196. Padding type:
  1197. - 0 = CONSTANT
  1198. - 1 = REPLICATE
  1199. - 2 = REFLECT
  1200. # Permute
  1201. ```
  1202. y = reorder(x)
  1203. ```
  1204. | param id | name | type | default | description |
  1205. | --------- | ------------- | ---- | --------- | ----------------- |
  1206. | 0 | order_type | int | 0 | |
  1207. Order Type:
  1208. - 0 = WH WHC WHDC
  1209. - 1 = HW HWC HWDC
  1210. - 2 = WCH WDHC
  1211. - 3 = CWH DWHC
  1212. - 4 = HCW HDWC
  1213. - 5 = CHW DHWC
  1214. - 6 = WHCD
  1215. - 7 = HWCD
  1216. - 8 = WCHD
  1217. - 9 = CWHD
  1218. - 10 = HCWD
  1219. - 11 = CHWD
  1220. - 12 = WDCH
  1221. - 13 = DWCH
  1222. - 14 = WCDH
  1223. - 15 = CWDH
  1224. - 16 = DCWH
  1225. - 17 = CDWH
  1226. - 18 = HDCW
  1227. - 19 = DHCW
  1228. - 20 = HCDW
  1229. - 21 = CHDW
  1230. - 22 = DCHW
  1231. - 23 = CDHW
  1232. # PixelShuffle
  1233. ```
  1234. if mode == 0 y = depth_to_space(x) where x channel order is sw-sh-outc
  1235. if mode == 1 y = depth_to_space(x) where x channel order is outc-sw-sh
  1236. ```
  1237. * one_blob_only
  1238. | param id | name | type | default | description |
  1239. | --------- | ------------- | ---- | --------- | ----------------- |
  1240. | 0 | upscale_factor| int | 1 | |
  1241. | 1 | mode | int | 0 | |
  1242. # Pooling
  1243. ```
  1244. x2 = pad(x, pads)
  1245. x3 = pooling(x2, kernel, stride)
  1246. ```
  1247. | param id | name | type | default | description |
  1248. | --------- | --------------| ---- | --------- | ----------------- |
  1249. | 0 | pooling_type | int | 0 | |
  1250. | 1 | kernel_w | int | 0 | |
  1251. | 2 | stride_w | int | 1 | |
  1252. | 3 | pad_left | int | 0 | |
  1253. | 4 | global_pooling| int | 0 | |
  1254. | 5 | pad_mode | int | 0 | |
  1255. | 6 | avgpool_count_include_pad| int | 0 | |
  1256. | 7 | adaptive_pooling| int | 0 | |
  1257. | 8 | out_w | int | 0 | |
  1258. | 11 | kernel_h | int | kernel_w | |
  1259. | 12 | stride_h | int | stride_w | |
  1260. | 13 | pad_top | int | pad_left | |
  1261. | 14 | pad_right | int | pad_left | |
  1262. | 15 | pad_bottom | int | pad_top | |
  1263. | 18 | out_h | int | out_w | |
  1264. Pooling type:
  1265. - 0 = MAX
  1266. - 1 = AVG
  1267. Pad mode:
  1268. - 0 = full padding
  1269. - 1 = valid padding
  1270. - 2 = tensorflow padding=SAME or onnx padding=SAME_UPPER
  1271. - 3 = onnx padding=SAME_LOWER
  1272. # Pooling1D
  1273. ```
  1274. x2 = pad(x, pads)
  1275. x3 = pooling1d(x2, kernel, stride)
  1276. ```
  1277. | param id | name | type | default | description |
  1278. | --------- | --------------| ---- | --------- | ----------------- |
  1279. | 0 | pooling_type | int | 0 | |
  1280. | 1 | kernel_w | int | 0 | |
  1281. | 2 | stride_w | int | 1 | |
  1282. | 3 | pad_left | int | 0 | |
  1283. | 4 | global_pooling| int | 0 | |
  1284. | 5 | pad_mode | int | 0 | |
  1285. | 6 | avgpool_count_include_pad| int | 0 | |
  1286. | 7 | adaptive_pooling| int | 0 | |
  1287. | 8 | out_w | int | 0 | |
  1288. | 14 | pad_right | int | pad_left | |
  1289. Pooling type:
  1290. - 0 = MAX
  1291. - 1 = AVG
  1292. Pad mode:
  1293. - 0 = full padding
  1294. - 1 = valid padding
  1295. - 2 = tensorflow padding=SAME or onnx padding=SAME_UPPER
  1296. - 3 = onnx padding=SAME_LOWER
  1297. # Pooling3D
  1298. ```
  1299. x2 = pad(x, pads)
  1300. x3 = pooling3d(x2, kernel, stride)
  1301. ```
  1302. | param id | name | type | default | description |
  1303. | --------- | --------------| ---- | --------- | ----------------- |
  1304. | 0 | pooling_type | int | 0 | |
  1305. | 1 | kernel_w | int | 0 | |
  1306. | 2 | stride_w | int | 1 | |
  1307. | 3 | pad_left | int | 0 | |
  1308. | 4 | global_pooling| int | 0 | |
  1309. | 5 | pad_mode | int | 0 | |
  1310. | 6 | avgpool_count_include_pad| int | 0 | |
  1311. | 7 | adaptive_pooling| int | 0 | |
  1312. | 8 | out_w | int | 0 | |
  1313. | 11 | kernel_h | int | kernel_w | |
  1314. | 12 | stride_h | int | stride_w | |
  1315. | 13 | pad_top | int | pad_left | |
  1316. | 14 | pad_right | int | pad_left | |
  1317. | 15 | pad_bottom | int | pad_top | |
  1318. | 16 | pad_behind | int | pad_front | |
  1319. | 18 | out_h | int | out_w | |
  1320. | 21 | kernel_d | int | kernel_w | |
  1321. | 22 | stride_d | int | stride_w | |
  1322. | 23 | pad_front | int | pad_left | |
  1323. | 28 | out_d | int | out_w | |
  1324. Pooling type:
  1325. - 0 = MAX
  1326. - 1 = AVG
  1327. Pad mode:
  1328. - 0 = full padding
  1329. - 1 = valid padding
  1330. - 2 = tensorflow padding=SAME or onnx padding=SAME_UPPER
  1331. - 3 = onnx padding=SAME_LOWER
  1332. # Power
  1333. ```
  1334. y = pow((shift + x * scale), power)
  1335. ```
  1336. * one_blob_only
  1337. * support_inplace
  1338. | param id | name | type | default | description |
  1339. | --------- | ------------- | ----- | --------- | ----------------- |
  1340. | 0 | power | float | 1.f | |
  1341. | 1 | scale | float | 1.f | |
  1342. | 2 | shift | float | 0.f | |
  1343. # PReLU
  1344. ```
  1345. if x < 0 y = x * slope
  1346. else y = x
  1347. ```
  1348. * one_blob_only
  1349. * support_inplace
  1350. | param id | name | type | default | description |
  1351. | --------- | ------------- | ----- | --------- | ----------------- |
  1352. | 0 | num_slope | int | 0 | |
  1353. | weight | type | shape |
  1354. | ------------- | ----- | --------------------- |
  1355. | slope_data | float | [num_slope] |
  1356. # Quantize
  1357. ```
  1358. y = float2int8(x * scale)
  1359. ```
  1360. * one_blob_only
  1361. | param id | name | type | default | description |
  1362. | --------- | ------------- | ----- | --------- | ----------------- |
  1363. | 0 | scale_data_size| int | 1 | |
  1364. | weight | type | shape |
  1365. | ------------- | ----- | --------------------- |
  1366. | scale_data | float | [scale_data_size] |
  1367. # Reduction
  1368. ```
  1369. y = reduce_op(x * coeff)
  1370. ```
  1371. * one_blob_only
  1372. | param id | name | type | default | description |
  1373. | --------- | ------------- | ----- | --------- | ----------------- |
  1374. | 0 | operation | int | 0 | |
  1375. | 1 | reduce_all | int | 1 | |
  1376. | 2 | coeff | float | 1.f | |
  1377. | 3 | axes | array | [ ] | |
  1378. | 4 | keepdims | int | 0 | |
  1379. | 5 | fixbug0 | int | 0 | hack for bug fix, should be 1 |
  1380. Operation type:
  1381. - 0 = SUM
  1382. - 1 = ASUM
  1383. - 2 = SUMSQ
  1384. - 3 = MEAN
  1385. - 4 = MAX
  1386. - 5 = MIN
  1387. - 6 = PROD
  1388. - 7 = L1
  1389. - 8 = L2
  1390. - 9 = LogSum
  1391. - 10 = LogSumExp
  1392. # ReLU
  1393. ```
  1394. if x < 0 y = x * slope
  1395. else y = x
  1396. ```
  1397. * one_blob_only
  1398. * support_inplace
  1399. | param id | name | type | default | description |
  1400. | --------- | ------------- | ----- | --------- | ----------------- |
  1401. | 0 | slope | float | 0.f | |
  1402. # Reorg
  1403. ```
  1404. if mode == 0 y = space_to_depth(x) where x channel order is sw-sh-outc
  1405. if mode == 1 y = space_to_depth(x) where x channel order is outc-sw-sh
  1406. ```
  1407. * one_blob_only
  1408. | param id | name | type | default | description |
  1409. | --------- | ------------- | ---- | --------- | ----------------- |
  1410. | 0 | stride | int | 1 | |
  1411. | 1 | mode | int | 0 | |
  1412. # Requantize
  1413. ```
  1414. x2 = x * scale_in + bias
  1415. x3 = activation(x2)
  1416. y = float2int8(x3 * scale_out)
  1417. ```
  1418. * one_blob_only
  1419. | param id | name | type | default | description |
  1420. | --------- | ------------- | ----- | --------- | ----------------- |
  1421. | 0 | scale_in_data_size| int | 1 | |
  1422. | 1 | scale_out_data_size| int | 1 | |
  1423. | 2 | bias_data_size| int | 0 | |
  1424. | 3 | activation_type| int | 0 | |
  1425. | 4 | activation_params| int | [ ] | |
  1426. | weight | type | shape |
  1427. | ------------- | ----- | --------------------- |
  1428. | scale_in_data | float | [scale_in_data_size] |
  1429. | scale_out_data| float | [scale_out_data_size] |
  1430. | bias_data | float | [bias_data_size] |
  1431. # Reshape
  1432. ```
  1433. y = reshape(x)
  1434. ```
  1435. * one_blob_only
  1436. | param id | name | type | default | description |
  1437. | --------- | ------------- | ----- | --------- | ----------------- |
  1438. | 0 | w | int | -233 | |
  1439. | 1 | h | int | -233 | |
  1440. | 11 | d | int | -233 | |
  1441. | 2 | c | int | -233 | |
  1442. | 6 | shape_expr | str | "" | |
  1443. Reshape flag:
  1444. - 0 = copy from bottom
  1445. - -1 = remaining
  1446. - -233 = drop this dim(default)
  1447. # RMSNorm
  1448. ```
  1449. split x along outmost axis into part x0, x1 ...
  1450. root mean square normalize for each part x0, x1 ...
  1451. y = x * gamma by elementwise
  1452. ```
  1453. * one_blob_only
  1454. * support_inplace
  1455. | param id | name | type | default | description |
  1456. | --------- | ------------- | ----- | --------- | ----------------- |
  1457. | 0 | affine_size | int | 0 | |
  1458. | 1 | eps | float | 0.001f | x = x / sqrt(var + eps) |
  1459. | 2 | affine | int | 1 | |
  1460. | weight | type | shape |
  1461. | ------------- | ----- | --------------------- |
  1462. | gamma_data | float | [affine_size] |
  1463. # RNN
  1464. 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]`.
  1465. ```
  1466. y = rnn(x)
  1467. y0, hidden y1 = rnn(x0, hidden x1)
  1468. ```
  1469. * one_blob_only if bidirectional
  1470. | param id | name | type | default | description |
  1471. | --------- | ------------- | ----- | --------- | ----------------- |
  1472. | 0 | num_output | int | 0 | hidden size of output |
  1473. | 1 | weight_data_size| int | 0 | total size of weight matrix |
  1474. | 2 | direction | int | 0 | 0=forward, 1=reverse, 2=bidirectional |
  1475. | weight | type | shape |
  1476. | ------------- | ----- | --------------------- |
  1477. | weight_xc_data| float/fp16/int8 | [input_size, num_output, num_directions] |
  1478. | bias_c_data | float/fp16/int8 | [num_output, 1, num_directions] |
  1479. | weight_hc_data| float/fp16/int8 | [num_output, num_output, num_directions] |
  1480. Direction flag:
  1481. - 0 = forward only
  1482. - 1 = reverse only
  1483. - 2 = bidirectional
  1484. # Scale
  1485. ```
  1486. if scale_data_size == -233 y = x0 * x1
  1487. else y = x * scale + bias
  1488. ```
  1489. * one_blob_only if scale_data_size != -233
  1490. * support_inplace
  1491. | param id | name | type | default | description |
  1492. | --------- | ------------- | ----- | --------- | ----------------- |
  1493. | 0 | scale_data_size| int | 0 | |
  1494. | 1 | bias_term | int | 0 | |
  1495. | weight | type | shape |
  1496. | ------------- | ----- | --------------------- |
  1497. | scale_data | float | [scale_data_size] |
  1498. | bias_data | float | [scale_data_size] |
  1499. # SELU
  1500. ```
  1501. if x < 0 y = (exp(x) - 1.f) * alpha * lambda
  1502. else y = x * lambda
  1503. ```
  1504. * one_blob_only
  1505. * support_inplace
  1506. | param id | name | type | default | description |
  1507. | --------- | ------------- | ----- | --------- | ----------------- |
  1508. | 0 | alpha | float | 1.67326324f| |
  1509. | 1 | lambda | float | 1.050700987f| |
  1510. # Shrink
  1511. ```
  1512. if x < -lambd y = x + bias
  1513. if x > lambd y = x - bias
  1514. else y = x
  1515. ```
  1516. * one_blob_only
  1517. * support_inplace
  1518. | param id | name | type | default | description |
  1519. | --------- | ------------- | ----- | --------- | ----------------- |
  1520. | 0 | bias | float | 0.0f | |
  1521. | 1 | lambd | float | 0.5f | |
  1522. # ShuffleChannel
  1523. ```
  1524. if reverse == 0 y = shufflechannel(x) by group
  1525. if reverse == 1 y = shufflechannel(x) by channel / group
  1526. ```
  1527. * one_blob_only
  1528. | param id | name | type | default | description |
  1529. | --------- | ------------- | ---- | --------- | ----------------- |
  1530. | 0 | group | int | 1 | |
  1531. | 1 | reverse | int | 0 | |
  1532. # Sigmoid
  1533. ```
  1534. y = 1 / (1 + exp(-x))
  1535. ```
  1536. * one_blob_only
  1537. * support_inplace
  1538. # Slice
  1539. ```
  1540. split x along axis into slices, each part slice size is based on slices array
  1541. ```
  1542. | param id | name | type | default | description |
  1543. | --------- | ------------- | ----- | --------- | ----------------- |
  1544. | 0 | slices | array | [ ] | |
  1545. | 1 | axis | int | 0 | |
  1546. | 2 | indices | array | [ ] | |
  1547. # Softmax
  1548. ```
  1549. softmax(x, axis)
  1550. ```
  1551. * one_blob_only
  1552. * support_inplace
  1553. | param id | name | type | default | description |
  1554. | --------- | ------------- | ----- | --------- | ----------------- |
  1555. | 0 | axis | int | 0 | |
  1556. | 1 | fixbug0 | int | 0 | hack for bug fix, should be 1 |
  1557. # Softplus
  1558. ```
  1559. y = log(exp(x) + 1)
  1560. ```
  1561. * one_blob_only
  1562. * support_inplace
  1563. # Spectrogram
  1564. ```
  1565. x1 = pad(x) if center
  1566. y = stft(x1)
  1567. y = y / sqrt(norm) if normalized
  1568. if power == 0 return y as real
  1569. if power == 1 return magnitude
  1570. if power == 2 return square of magnitude
  1571. ```
  1572. * one_blob_only
  1573. | param id | name | type | default | description |
  1574. | --------- | ------------- | ----- | --------- | ----------------- |
  1575. | 0 | n_fft | int | 0 | |
  1576. | 1 | power | int | 0 | |
  1577. | 2 | hoplen | int | n_fft / 4 | |
  1578. | 3 | winlen | int | n_fft | |
  1579. | 4 | window_type | int | 0 | 0=ones 1=hann 2=hamming |
  1580. | 5 | center | int | 1 | |
  1581. | 6 | pad_type | int | 2 | 0=CONSTANT 1=REPLICATE 2=REFLECT |
  1582. | 7 | normalized | int | 0 | 0=no 1=n_fft 2=window-l2-energy |
  1583. | 8 | onesided | int | 1 | |
  1584. # Split
  1585. ```
  1586. y0, y1 ... = x
  1587. ```
  1588. # Swish
  1589. ```
  1590. y = x / (1 + exp(-x))
  1591. ```
  1592. * one_blob_only
  1593. * support_inplace
  1594. # TanH
  1595. ```
  1596. y = tanh(x)
  1597. ```
  1598. * one_blob_only
  1599. * support_inplace
  1600. # Threshold
  1601. ```
  1602. if x > threshold y = 1
  1603. else y = 0
  1604. ```
  1605. * one_blob_only
  1606. * support_inplace
  1607. | param id | name | type | default | description |
  1608. | --------- | ------------- | ----- | --------- | ----------------- |
  1609. | 0 | threshold | float | 0.f | |
  1610. # Tile
  1611. ```
  1612. y = repeat tiles along axis for x
  1613. ```
  1614. * one_blob_only
  1615. | param id | name | type | default | description |
  1616. | --------- | ------------- | ----- | --------- | ----------------- |
  1617. | 0 | axis | int | 0 | |
  1618. | 1 | tiles | int | 1 | |
  1619. | 2 | repeats | array | [ ] | |
  1620. # UnaryOp
  1621. ```
  1622. y = unaryop(x)
  1623. ```
  1624. - one_blob_only
  1625. - support_inplace
  1626. | param id | name | type | default | description |
  1627. | --------- | ------------- | ----- | --------- | ----------------- |
  1628. | 0 | op_type | int | 0 | Operation type as follows |
  1629. Operation type:
  1630. - 0 = ABS
  1631. - 1 = NEG
  1632. - 2 = FLOOR
  1633. - 3 = CEIL
  1634. - 4 = SQUARE
  1635. - 5 = SQRT
  1636. - 6 = RSQ
  1637. - 7 = EXP
  1638. - 8 = LOG
  1639. - 9 = SIN
  1640. - 10 = COS
  1641. - 11 = TAN
  1642. - 12 = ASIN
  1643. - 13 = ACOS
  1644. - 14 = ATAN
  1645. - 15 = RECIPROCAL
  1646. - 16 = TANH
  1647. - 17 = LOG10
  1648. - 18 = ROUND
  1649. - 19 = TRUNC
  1650. # Unfold
  1651. ```
  1652. y = unfold(x)
  1653. ```
  1654. * one_blob_only
  1655. | param id | name | type | default | description |
  1656. | --------- | ------------- | ----- | --------- | ----------------- |
  1657. | 0 | num_output | int | 0 | |
  1658. | 1 | kernel_w | int | 0 | |
  1659. | 2 | dilation_w | int | 1 | |
  1660. | 3 | stride_w | int | 1 | |
  1661. | 4 | pad_left | int | 0 | |
  1662. | 11 | kernel_h | int | kernel_w | |
  1663. | 12 | dilation_h | int | dilation_w | |
  1664. | 13 | stride_h | int | stride_w | |
  1665. | 14 | pad_top | int | pad_left | |
  1666. | 15 | pad_right | int | pad_left | |
  1667. | 16 | pad_bottom | int | pad_top | |