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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983
  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. # CumulativeSum
  436. If axis < 0, we use axis = x.dims + axis
  437. It implements https://pytorch.org/docs/stable/generated/torch.cumsum.html
  438. * one_blob_only
  439. * support_inplace
  440. | param id | name | type | default | description |
  441. | --------- | ------------- | ----- | --------- | ----------------- |
  442. | 0 | axis | int | 0 | |
  443. # Deconvolution
  444. ```
  445. x2 = deconv(x, weight, kernel, stride, dilation) + bias
  446. x3 = depad(x2, pads, pad_value)
  447. y = activation(x3, act_type, act_params)
  448. ```
  449. * one_blob_only
  450. | param id | name | type | default | description |
  451. | --------- | ------------- | ----- | --------- | ----------------- |
  452. | 0 | num_output | int | 0 | |
  453. | 1 | kernel_w | int | 0 | |
  454. | 2 | dilation_w | int | 1 | |
  455. | 3 | stride_w | int | 1 | |
  456. | 4 | pad_left | int | 0 | |
  457. | 5 | bias_term | int | 0 | |
  458. | 6 | weight_data_size| int | 0 | |
  459. | 9 | activation_type| int | 0 | |
  460. | 10 | activation_params| array | [ ] | |
  461. | 11 | kernel_h | int | kernel_w | |
  462. | 12 | dilation_h | int | dilation_w | |
  463. | 13 | stride_h | int | stride_w | |
  464. | 14 | pad_top | int | pad_left | |
  465. | 15 | pad_right | int | pad_left | |
  466. | 16 | pad_bottom | int | pad_top | |
  467. | 18 | output_pad_right| int | 0 | |
  468. | 19 | output_pad_bottom| int | output_pad_right | |
  469. | 20 | output_w | int | 0 | |
  470. | 21 | output_h | int | output_w | |
  471. | 28 | dynamic_weight| int | 0 | |
  472. | weight | type | shape |
  473. | ------------- | ----- | --------------------- |
  474. | weight_data | float/fp16 | [kernel_w, kernel_h, num_input, num_output] |
  475. | bias_data | float | [num_output] |
  476. # Deconvolution1D
  477. ```
  478. x2 = deconv1d(x, weight, kernel, stride, dilation) + bias
  479. x3 = depad(x2, pads, pad_value)
  480. y = activation(x3, act_type, act_params)
  481. ```
  482. * one_blob_only
  483. | param id | name | type | default | description |
  484. | --------- | ------------- | ----- | --------- | ----------------- |
  485. | 0 | num_output | int | 0 | |
  486. | 1 | kernel_w | int | 0 | |
  487. | 2 | dilation_w | int | 1 | |
  488. | 3 | stride_w | int | 1 | |
  489. | 4 | pad_left | int | 0 | |
  490. | 5 | bias_term | int | 0 | |
  491. | 6 | weight_data_size| int | 0 | |
  492. | 9 | activation_type| int | 0 | |
  493. | 10 | activation_params| array | [ ] | |
  494. | 15 | pad_right | int | pad_left | |
  495. | 18 | output_pad_right| int | 0 | |
  496. | 20 | output_w | int | 0 | |
  497. | 28 | dynamic_weight| int | 0 | |
  498. | weight | type | shape |
  499. | ------------- | ----- | --------------------- |
  500. | weight_data | float/fp16 | [kernel_w, num_input, num_output] |
  501. | bias_data | float | [num_output] |
  502. # Deconvolution3D
  503. ```
  504. x2 = deconv3d(x, weight, kernel, stride, dilation) + bias
  505. x3 = depad(x2, pads, pad_value)
  506. y = activation(x3, act_type, act_params)
  507. ```
  508. * one_blob_only
  509. | param id | name | type | default | description |
  510. | --------- | ------------- | ----- | --------- | ----------------- |
  511. | 0 | num_output | int | 0 | |
  512. | 1 | kernel_w | int | 0 | |
  513. | 2 | dilation_w | int | 1 | |
  514. | 3 | stride_w | int | 1 | |
  515. | 4 | pad_left | int | 0 | |
  516. | 5 | bias_term | int | 0 | |
  517. | 6 | weight_data_size| int | 0 | |
  518. | 9 | activation_type| int | 0 | |
  519. | 10 | activation_params| array | [ ] | |
  520. | 11 | kernel_h | int | kernel_w | |
  521. | 12 | dilation_h | int | dilation_w | |
  522. | 13 | stride_h | int | stride_w | |
  523. | 14 | pad_top | int | pad_left | |
  524. | 15 | pad_right | int | pad_left | |
  525. | 16 | pad_bottom | int | pad_top | |
  526. | 17 | pad_behind | int | pad_front | |
  527. | 18 | output_pad_right| int | 0 | |
  528. | 19 | output_pad_bottom| int | output_pad_right | |
  529. | 20 | output_pad_behind| int | output_pad_right | |
  530. | 21 | kernel_d | int | kernel_w | |
  531. | 22 | dilation_d | int | dilation_w | |
  532. | 23 | stride_d | int | stride_w | |
  533. | 24 | pad_front | int | pad_left | |
  534. | 25 | output_w | int | 0 | |
  535. | 26 | output_h | int | output_w | |
  536. | 27 | output_d | int | output_w | |
  537. | weight | type | shape |
  538. | ------------- | ----- | --------------------- |
  539. | weight_data | float/fp16 | [kernel_w, kernel_h, kernel_d, num_input, num_output] |
  540. | bias_data | float | [num_output] |
  541. # DeconvolutionDepthWise
  542. ```
  543. x2 = deconv(x, weight, kernel, stride, dilation, group) + bias
  544. x3 = depad(x2, pads, pad_value)
  545. y = activation(x3, act_type, act_params)
  546. ```
  547. * one_blob_only
  548. | param id | name | type | default | description |
  549. | --------- | ------------- | ----- | --------- | ----------------- |
  550. | 0 | num_output | int | 0 | |
  551. | 1 | kernel_w | int | 0 | |
  552. | 2 | dilation_w | int | 1 | |
  553. | 3 | stride_w | int | 1 | |
  554. | 4 | pad_left | int | 0 | |
  555. | 5 | bias_term | int | 0 | |
  556. | 6 | weight_data_size| int | 0 | |
  557. | 7 | group | int | 1 | |
  558. | 9 | activation_type| int | 0 | |
  559. | 10 | activation_params| array | [ ] | |
  560. | 11 | kernel_h | int | kernel_w | |
  561. | 12 | dilation_h | int | dilation_w | |
  562. | 13 | stride_h | int | stride_w | |
  563. | 14 | pad_top | int | pad_left | |
  564. | 15 | pad_right | int | pad_left | |
  565. | 16 | pad_bottom | int | pad_top | |
  566. | 18 | output_pad_right| int | 0 | |
  567. | 19 | output_pad_bottom| int | output_pad_right | |
  568. | 20 | output_w | int | 0 | |
  569. | 21 | output_h | int | output_w | |
  570. | 28 | dynamic_weight| int | 0 | |
  571. | weight | type | shape |
  572. | ------------- | ----- | --------------------- |
  573. | weight_data | float/fp16 | [kernel_w, kernel_h, num_input / group, num_output / group, group] |
  574. | bias_data | float | [num_output] |
  575. # DeconvolutionDepthWise1D
  576. ```
  577. x2 = deconv1d(x, weight, kernel, stride, dilation, group) + bias
  578. x3 = depad(x2, pads, pad_value)
  579. y = activation(x3, act_type, act_params)
  580. ```
  581. * one_blob_only
  582. | param id | name | type | default | description |
  583. | --------- | ------------- | ----- | --------- | ----------------- |
  584. | 0 | num_output | int | 0 | |
  585. | 1 | kernel_w | int | 0 | |
  586. | 2 | dilation_w | int | 1 | |
  587. | 3 | stride_w | int | 1 | |
  588. | 4 | pad_left | int | 0 | |
  589. | 5 | bias_term | int | 0 | |
  590. | 6 | weight_data_size| int | 0 | |
  591. | 7 | group | int | 1 | |
  592. | 9 | activation_type| int | 0 | |
  593. | 10 | activation_params| array | [ ] | |
  594. | 15 | pad_right | int | pad_left | |
  595. | 18 | output_pad_right| int | 0 | |
  596. | 20 | output_w | int | 0 | |
  597. | 28 | dynamic_weight| int | 0 | |
  598. | weight | type | shape |
  599. | ------------- | ----- | --------------------- |
  600. | weight_data | float/fp16 | [kernel_w, num_input / group, num_output / group, group] |
  601. | bias_data | float | [num_output] |
  602. # DeconvolutionDepthWise3D
  603. ```
  604. x2 = deconv3d(x, weight, kernel, stride, dilation, group) + bias
  605. x3 = depad(x2, pads, pad_value)
  606. y = activation(x3, act_type, act_params)
  607. ```
  608. * one_blob_only
  609. | param id | name | type | default | description |
  610. | --------- | ------------- | ----- | --------- | ----------------- |
  611. | 0 | num_output | int | 0 | |
  612. | 1 | kernel_w | int | 0 | |
  613. | 2 | dilation_w | int | 1 | |
  614. | 3 | stride_w | int | 1 | |
  615. | 4 | pad_left | int | 0 | |
  616. | 5 | bias_term | int | 0 | |
  617. | 6 | weight_data_size| int | 0 | |
  618. | 7 | group | int | 1 | |
  619. | 9 | activation_type| int | 0 | |
  620. | 10 | activation_params| array | [ ] | |
  621. | 11 | kernel_h | int | kernel_w | |
  622. | 12 | dilation_h | int | dilation_w | |
  623. | 13 | stride_h | int | stride_w | |
  624. | 14 | pad_top | int | pad_left | |
  625. | 15 | pad_right | int | pad_left | |
  626. | 16 | pad_bottom | int | pad_top | |
  627. | 17 | pad_behind | int | pad_front | |
  628. | 18 | output_pad_right| int | 0 | |
  629. | 19 | output_pad_bottom| int | output_pad_right | |
  630. | 20 | output_pad_behind| int | output_pad_right | |
  631. | 21 | kernel_d | int | kernel_w | |
  632. | 22 | dilation_d | int | dilation_w | |
  633. | 23 | stride_d | int | stride_w | |
  634. | 24 | pad_front | int | pad_left | |
  635. | 25 | output_w | int | 0 | |
  636. | 26 | output_h | int | output_w | |
  637. | 27 | output_d | int | output_w | |
  638. | weight | type | shape |
  639. | ------------- | ----- | --------------------- |
  640. | weight_data | float/fp16 | [kernel_w, kernel_h, kernel_d, num_input / group, num_output / group, group] |
  641. | bias_data | float | [num_output] |
  642. # DeformableConv2D
  643. ```
  644. x2 = deformableconv2d(x, offset, mask, weight, kernel, stride, dilation) + bias
  645. y = activation(x2, act_type, act_params)
  646. ```
  647. | param id | name | type | default | description |
  648. | --------- | ------------- | ----- | --------- | ----------------- |
  649. | 0 | num_output | int | 0 | |
  650. | 1 | kernel_w | int | 0 | |
  651. | 2 | dilation_w | int | 1 | |
  652. | 3 | stride_w | int | 1 | |
  653. | 4 | pad_left | int | 0 | |
  654. | 5 | bias_term | int | 0 | |
  655. | 6 | weight_data_size| int | 0 | |
  656. | 9 | activation_type| int | 0 | |
  657. | 10 | activation_params| array | [ ] | |
  658. | 11 | kernel_h | int | kernel_w | |
  659. | 12 | dilation_h | int | dilation_w | |
  660. | 13 | stride_h | int | stride_w | |
  661. | 14 | pad_top | int | pad_left | |
  662. | 15 | pad_right | int | pad_left | |
  663. | 16 | pad_bottom | int | pad_top | |
  664. | weight | type | shape |
  665. | ------------- | ----- | --------------------- |
  666. | weight_data | float/fp16/int8 | [kernel_w, kernel_h, num_input, num_output] |
  667. | bias_data | float | [num_output] |
  668. # Dequantize
  669. ```
  670. y = x * scale + bias
  671. ```
  672. * one_blob_only
  673. * support_inplace
  674. | param id | name | type | default | description |
  675. | --------- | ------------- | ----- | --------- | ----------------- |
  676. | 0 | scale_data_size| int | 1 | |
  677. | 1 | bias_data_size| int | 0 | |
  678. | weight | type | shape |
  679. | ------------- | ----- | --------------------- |
  680. | scale_data | float | [scale_data_size] |
  681. | bias_data | float | [bias_data_size] |
  682. # Diag
  683. ```
  684. y = diag(x, diagonal)
  685. ```
  686. * one_blob_only
  687. | param id | name | type | default | description |
  688. | --------- | ------------- | ----- | --------- | ----------------- |
  689. | 0 | diagonal | int | 0 | |
  690. # Dropout
  691. ```
  692. y = x * scale
  693. ```
  694. * one_blob_only
  695. | param id | name | type | default | description |
  696. | --------- | ------------- | ----- | --------- | ----------------- |
  697. | 0 | scale | float | 1.f | |
  698. # Eltwise
  699. ```
  700. y = elementwise_op(x0, x1, ...)
  701. ```
  702. | param id | name | type | default | description |
  703. | --------- | ------------- | ----- | --------- | ----------------- |
  704. | 0 | op_type | int | 0 | |
  705. | 1 | coeffs | array | [ ] | |
  706. Operation type:
  707. - 0 = PROD
  708. - 1 = SUM
  709. - 2 = MAX
  710. # ELU
  711. ```
  712. if x < 0 y = (exp(x) - 1) * alpha
  713. else y = x
  714. ```
  715. * one_blob_only
  716. * support_inplace
  717. | param id | name | type | default | description |
  718. | --------- | ------------- | ----- | --------- | ----------------- |
  719. | 0 | alpha | float | 0.1f | |
  720. # Embed
  721. ```
  722. y = embedding(x)
  723. ```
  724. | param id | name | type | default | description |
  725. | --------- | ------------- | ----- | --------- | ----------------- |
  726. | 0 | num_output | int | 0 | |
  727. | 1 | input_dim | int | 0 | |
  728. | 2 | bias_term | int | 0 | |
  729. | 3 | weight_data_size | int | 0 | |
  730. | 18 | int8_scale_term| int | 0 | |
  731. | weight | type | shape |
  732. | ------------- | ----- | --------------------- |
  733. | weight_data | float | [weight_data_size] |
  734. | bias_term | float | [num_output] |
  735. | weight_data_int8_scales| float | [1] |
  736. # Exp
  737. ```
  738. if base == -1 y = exp(shift + x * scale)
  739. else y = pow(base, (shift + x * scale))
  740. ```
  741. * one_blob_only
  742. * support_inplace
  743. | param id | name | type | default | description |
  744. | --------- | ------------- | ----- | --------- | ----------------- |
  745. | 0 | base | float | -1.f | |
  746. | 1 | scale | float | 1.f | |
  747. | 2 | shift | float | 0.f | |
  748. # Flatten
  749. Reshape blob to 1 dimension
  750. * one_blob_only
  751. # Fold
  752. ```
  753. y = fold(x)
  754. ```
  755. * one_blob_only
  756. | param id | name | type | default | description |
  757. | --------- | ------------- | ----- | --------- | ----------------- |
  758. | 0 | num_output | int | 0 | |
  759. | 1 | kernel_w | int | 0 | |
  760. | 2 | dilation_w | int | 1 | |
  761. | 3 | stride_w | int | 1 | |
  762. | 4 | pad_left | int | 0 | |
  763. | 11 | kernel_h | int | kernel_w | |
  764. | 12 | dilation_h | int | dilation_w | |
  765. | 13 | stride_h | int | stride_w | |
  766. | 14 | pad_top | int | pad_left | |
  767. | 15 | pad_right | int | pad_left | |
  768. | 16 | pad_bottom | int | pad_top | |
  769. | 20 | output_w | int | 0 | |
  770. | 21 | output_h | int | output_w | |
  771. # GELU
  772. ```
  773. if fast_gelu == 1 y = 0.5 * x * (1 + tanh(0.79788452 * (x + 0.044715 * x * x * x)));
  774. else y = 0.5 * x * erfc(-0.70710678 * x)
  775. ```
  776. * one_blob_only
  777. * support_inplace
  778. | param id | name | type | default | description |
  779. | --------- | ------------- | ----- | --------- | ----------------- |
  780. | 0 | fast_gelu | int | 0 | use approximation |
  781. # GLU
  782. If axis < 0, we use axis = x.dims + axis
  783. GLU(a,b)=a⊗σ(b)
  784. where a is the first half of the input matrix and b is the second half.
  785. axis specifies the dimension to split the input
  786. * one_blob_only
  787. | param id | name | type | default | description |
  788. | --------- | ------------- | ----- | --------- | ----------------- |
  789. | 0 | axis | int | 0 | |
  790. # Gemm
  791. ```
  792. a = transA ? transpose(x0) : x0
  793. b = transb ? transpose(x1) : x1
  794. c = x2
  795. y = (gemm(a, b) + c * beta) * alpha
  796. ```
  797. | param id | name | type | default | description |
  798. | --------- | ------------- | ----- | --------- | ----------------- |
  799. | 0 | alpha | float | 1.f | |
  800. | 1 | beta | float | 1.f | |
  801. | 2 | transA | int | 0 | |
  802. | 3 | transb | int | 0 | |
  803. | 4 | constantA | int | 0 | |
  804. | 5 | constantB | int | 0 | |
  805. | 6 | constantC | int | 0 | |
  806. | 7 | constantM | int | 0 | |
  807. | 8 | constantN | int | 0 | |
  808. | 9 | constantK | int | 0 | |
  809. | 10 | constant_broadcast_type_C | int | 0 | |
  810. | 11 | output_N1M | int | 0 | |
  811. | 12 | output_elempack | int | 0 | |
  812. | 13 | output_elemtype | int | 0 | |
  813. | 14 | output_transpose | int| 0 | |
  814. | 18 | int8_scale_term | int | 0 | |
  815. | 20 | constant_TILE_M | int | 0 | |
  816. | 21 | constant_TILE_N | int | 0 | |
  817. | 22 | constant_TILE_K | int | 0 | |
  818. | weight | type | shape |
  819. | ------------- | ----- | --------------------- |
  820. | A_data | float/fp16/int8 | [M, K] or [K, M] |
  821. | B_data | float/fp16/int8 | [N, K] or [K, N] |
  822. | C_data | float | [1], [M] or [N] or [1, M] or [N,1] or [N, M] |
  823. | A_data_int8_scales| float | [M] |
  824. | B_data_int8_scales| float | [1] |
  825. # GridSample
  826. ```
  827. Given an input and a flow-field grid, computes the output using input values and pixel locations from grid.
  828. For each output location output[:, h2, w2], the size-2 vector grid[h2, w2, 2] specifies input pixel[:, h1, w1] locations x and y,
  829. which are used to interpolate the output value output[:, h2, w2]
  830. This function is often used in conjunction with affine_grid() to build Spatial Transformer Networks .
  831. ```
  832. | param id | name | type | default | description |
  833. | --------- | ------------- | ----- | --------- | ----------------- |
  834. | 0 | sample_type | int | 1 | |
  835. | 1 | padding_mode | int | 1 | |
  836. | 2 | align_corner | int | 0 | |
  837. | 3 | permute_fusion| int | 0 | fuse with permute |
  838. Sample type:
  839. - 1 = Nearest
  840. - 2 = Bilinear
  841. - 3 = Bicubic
  842. Padding mode:
  843. - 1 = zeros
  844. - 2 = border
  845. - 3 = reflection
  846. # GroupNorm
  847. ```
  848. split x along channel axis into group x0, x1 ...
  849. l2 normalize for each group x0, x1 ...
  850. y = x * gamma + beta
  851. ```
  852. * one_blob_only
  853. * support_inplace
  854. | param id | name | type | default | description |
  855. | --------- | ------------- | ----- | --------- | ----------------- |
  856. | 0 | group | int | 1 | |
  857. | 1 | channels | int | 0 | |
  858. | 2 | eps | float | 0.001f | x = x / sqrt(var + eps) |
  859. | 3 | affine | int | 1 | |
  860. | weight | type | shape |
  861. | ------------- | ----- | --------------------- |
  862. | gamma_data | float | [channels] |
  863. | beta_data | float | [channels] |
  864. # GRU
  865. 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]`.
  866. ```
  867. y = gru(x)
  868. y0, hidden y1 = gru(x0, hidden x1)
  869. ```
  870. * one_blob_only if bidirectional
  871. | param id | name | type | default | description |
  872. | --------- | ------------- | ----- | --------- | ----------------- |
  873. | 0 | num_output | int | 0 | hidden size of output |
  874. | 1 | weight_data_size| int | 0 | total size of weight matrix |
  875. | 2 | direction | int | 0 | 0=forward, 1=reverse, 2=bidirectional |
  876. | weight | type | shape |
  877. | ------------- | ----- | --------------------- |
  878. | weight_xc_data| float/fp16/int8 | [input_size, num_output * 3, num_directions] |
  879. | bias_c_data | float/fp16/int8 | [num_output, 4, num_directions] |
  880. | weight_hc_data| float/fp16/int8 | [num_output, num_output * 3, num_directions] |
  881. Direction flag:
  882. - 0 = forward only
  883. - 1 = reverse only
  884. - 2 = bidirectional
  885. # HardSigmoid
  886. ```
  887. y = clamp(x * alpha + beta, 0, 1)
  888. ```
  889. * one_blob_only
  890. * support_inplace
  891. | param id | name | type | default | description |
  892. | --------- | ------------- | ----- | --------- | ----------------- |
  893. | 0 | alpha | float | 0.2f | |
  894. | 1 | beta | float | 0.5f | |
  895. # HardSwish
  896. ```
  897. y = x * clamp(x * alpha + beta, 0, 1)
  898. ```
  899. * one_blob_only
  900. * support_inplace
  901. | param id | name | type | default | description |
  902. | --------- | ------------- | ----- | --------- | ----------------- |
  903. | 0 | alpha | float | 0.2f | |
  904. | 1 | beta | float | 0.5f | |
  905. # InnerProduct
  906. ```
  907. x2 = innerproduct(x, weight) + bias
  908. y = activation(x2, act_type, act_params)
  909. ```
  910. * one_blob_only
  911. | param id | name | type | default | description |
  912. | --------- | ------------- | ----- | --------- | ----------------- |
  913. | 0 | num_output | int | 0 | |
  914. | 1 | bias_term | int | 0 | |
  915. | 2 | weight_data_size| int | 0 | |
  916. | 8 | int8_scale_term| int | 0 | |
  917. | 9 | activation_type| int | 0 | |
  918. | 10 | activation_params| array | [ ] | |
  919. | weight | type | shape |
  920. | ------------- | ----- | --------------------- |
  921. | weight_data | float/fp16/int8 | [num_input, num_output] |
  922. | bias_data | float | [num_output] |
  923. | weight_data_int8_scales| float | [num_output] |
  924. | bottom_blob_int8_scales| float | [1] |
  925. # Input
  926. ```
  927. y = input
  928. ```
  929. * support_inplace
  930. | param id | name | type | default | description |
  931. | --------- | ------------- | ----- | --------- | ----------------- |
  932. | 0 | w | int | 0 | |
  933. | 1 | h | int | 0 | |
  934. | 11 | d | int | 0 | |
  935. | 2 | c | int | 0 | |
  936. # InstanceNorm
  937. ```
  938. split x along channel axis into instance x0, x1 ...
  939. l2 normalize for each channel instance x0, x1 ...
  940. y = x * gamma + beta
  941. ```
  942. * one_blob_only
  943. * support_inplace
  944. | param id | name | type | default | description |
  945. | --------- | ------------- | ----- | --------- | ----------------- |
  946. | 0 | channels | int | 0 | |
  947. | 1 | eps | float | 0.001f | x = x / sqrt(var + eps) |
  948. | 2 | affine | int | 1 | |
  949. | weight | type | shape |
  950. | ------------- | ----- | --------------------- |
  951. | gamma_data | float | [channels] |
  952. | beta_data | float | [channels] |
  953. # Interp
  954. ```
  955. if dynamic_target_size == 0 y = resize(x) by fixed size or scale
  956. else y = resize(x0, size(x1))
  957. ```
  958. * one_blob_only if dynamic_target_size == 0
  959. | param id | name | type | default | description |
  960. | --------- | ------------- | ----- | --------- | ----------------- |
  961. | 0 | resize_type | int | 0 | |
  962. | 1 | height_scale | float | 1.f | |
  963. | 2 | width_scale | float | 1.f | |
  964. | 3 | output_height | int | 0 | |
  965. | 4 | output_width | int | 0 | |
  966. | 5 | dynamic_target_size| int | 0 | |
  967. | 6 | align_corner | int | 0 | |
  968. Resize type:
  969. - 1 = Nearest
  970. - 2 = Bilinear
  971. - 3 = Bicubic
  972. # InverseSpectrogram
  973. ```
  974. x1 = x as complex
  975. x1 = x1 * sqrt(norm) if normalized
  976. y = istft(x1)
  977. y1 = unpad(y) if center
  978. if returns == 0 return y1 as complex
  979. if returns == 1 return y1 real
  980. if returns == 2 return y1 imag
  981. ```
  982. * one_blob_only
  983. | param id | name | type | default | description |
  984. | --------- | ------------- | ----- | --------- | ----------------- |
  985. | 0 | n_fft | int | 0 | |
  986. | 1 | returns | int | 1 | |
  987. | 2 | hoplen | int | n_fft / 4 | |
  988. | 3 | winlen | int | n_fft | |
  989. | 4 | window_type | int | 0 | 0=ones 1=hann 2=hamming |
  990. | 5 | center | int | 1 | |
  991. | 7 | normalized | int | 0 | 0=no 1=n_fft 2=window-l2-energy |
  992. # LayerNorm
  993. ```
  994. split x along outmost axis into part x0, x1 ...
  995. l2 normalize for each part x0, x1 ...
  996. y = x * gamma + beta by elementwise
  997. ```
  998. * one_blob_only
  999. * support_inplace
  1000. | param id | name | type | default | description |
  1001. | --------- | ------------- | ----- | --------- | ----------------- |
  1002. | 0 | affine_size | int | 0 | |
  1003. | 1 | eps | float | 0.001f | x = x / sqrt(var + eps) |
  1004. | 2 | affine | int | 1 | |
  1005. | weight | type | shape |
  1006. | ------------- | ----- | --------------------- |
  1007. | gamma_data | float | [affine_size] |
  1008. | beta_data | float | [affine_size] |
  1009. # Log
  1010. ```
  1011. if base == -1 y = log(shift + x * scale)
  1012. else y = log(shift + x * scale) / log(base)
  1013. ```
  1014. * one_blob_only
  1015. * support_inplace
  1016. | param id | name | type | default | description |
  1017. | --------- | ------------- | ----- | --------- | ----------------- |
  1018. | 0 | base | float | -1.f | |
  1019. | 1 | scale | float | 1.f | |
  1020. | 2 | shift | float | 0.f | |
  1021. # LRN
  1022. ```
  1023. if region_type == ACROSS_CHANNELS square_sum = sum of channel window of local_size
  1024. if region_type == WITHIN_CHANNEL square_sum = sum of spatial window of local_size
  1025. y = x * pow(bias + alpha * square_sum / (local_size * local_size), -beta)
  1026. ```
  1027. * one_blob_only
  1028. * support_inplace
  1029. | param id | name | type | default | description |
  1030. | --------- | ------------- | ----- | --------- | ----------------- |
  1031. | 0 | region_type | int | 0 | |
  1032. | 1 | local_size | int | 5 | |
  1033. | 2 | alpha | float | 1.f | |
  1034. | 3 | beta | float | 0.75f | |
  1035. | 4 | bias | float | 1.f | |
  1036. Region type:
  1037. - 0 = ACROSS_CHANNELS
  1038. - 1 = WITHIN_CHANNEL
  1039. # LSTM
  1040. 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]`.
  1041. ```
  1042. y = lstm(x)
  1043. y0, hidden y1, cell y2 = lstm(x0, hidden x1, cell x2)
  1044. ```
  1045. * one_blob_only if bidirectional
  1046. | param id | name | type | default | description |
  1047. | --------- | ------------- | ----- | --------- | ----------------- |
  1048. | 0 | num_output | int | 0 | output size of output |
  1049. | 1 | weight_data_size| int | 0 | total size of IFOG weight matrix |
  1050. | 2 | direction | int | 0 | 0=forward, 1=reverse, 2=bidirectional |
  1051. | 3 | hidden_size | int | num_output| hidden size |
  1052. | weight | type | shape |
  1053. | ------------- | ----- | --------------------- |
  1054. | weight_xc_data| float/fp16/int8 | [input_size, hidden_size * 4, num_directions] |
  1055. | bias_c_data | float/fp16/int8 | [hidden_size, 4, num_directions] |
  1056. | weight_hc_data| float/fp16/int8 | [num_output, hidden_size * 4, num_directions] |
  1057. | weight_hr_data| float/fp16/int8 | [hidden_size, num_output, num_directions] |
  1058. Direction flag:
  1059. - 0 = forward only
  1060. - 1 = reverse only
  1061. - 2 = bidirectional
  1062. # MemoryData
  1063. ```
  1064. y = data
  1065. ```
  1066. | param id | name | type | default | description |
  1067. | --------- | ------------- | ----- | --------- | ----------------- |
  1068. | 0 | w | int | 0 | |
  1069. | 1 | h | int | 0 | |
  1070. | 11 | d | int | 0 | |
  1071. | 2 | c | int | 0 | |
  1072. | 21 | load_type | int | 1 | 1=fp32 |
  1073. | weight | type | shape |
  1074. | ------------- | ----- | --------------------- |
  1075. | data | float | [w, h, d, c] |
  1076. # Mish
  1077. ```
  1078. y = x * tanh(log(exp(x) + 1))
  1079. ```
  1080. * one_blob_only
  1081. * support_inplace
  1082. # MultiHeadAttention
  1083. ```
  1084. split q k v into num_head part q0, k0, v0, q1, k1, v1 ...
  1085. for each num_head part
  1086. xq = affine(q) / (embed_dim / num_head)
  1087. xk = affine(k)
  1088. xv = affine(v)
  1089. xqk = xq * xk
  1090. xqk = xqk + attn_mask if attn_mask exists
  1091. softmax_inplace(xqk)
  1092. xqkv = xqk * xv
  1093. merge xqkv to out
  1094. y = affine(out)
  1095. ```
  1096. | param id | name | type | default | description |
  1097. | --------- | ------------- | ----- | --------- | ----------------- |
  1098. | 0 | embed_dim | int | 0 | |
  1099. | 1 | num_heads | int | 1 | |
  1100. | 2 | weight_data_size| int | 0 | qdim = weight_data_size / embed_dim |
  1101. | 3 | kdim | int | embed_dim | |
  1102. | 4 | vdim | int | embed_dim | |
  1103. | 5 | attn_mask | int | 0 | |
  1104. | 6 | scale | float | 1.f / sqrt(embed_dim / num_heads) | |
  1105. | 18 | int8_scale_term | int | 0 | |
  1106. | weight | type | shape |
  1107. | ------------- | ----- | --------------------- |
  1108. | q_weight_data | float/fp16/int8 | [embed_dim * qdim] |
  1109. | q_bias_data | float | [embed_dim] |
  1110. | k_weight_data | float/fp16/int8 | [embed_dim * kdim] |
  1111. | k_bias_data | float | [embed_dim] |
  1112. | v_weight_data | float/fp16/int8 | [embed_dim * vdim] |
  1113. | v_bias_data | float | [embed_dim] |
  1114. | out_weight_data| float/fp16/int8 | [qdim * embed_dim] |
  1115. | out_bias_data | float | [qdim] |
  1116. | q_weight_data_int8_scales| float | [embed_dim] |
  1117. | k_weight_data_int8_scales| float | [embed_dim] |
  1118. | v_weight_data_int8_scales| float | [embed_dim] |
  1119. | out_weight_data_int8_scales| float | [1] |
  1120. # MVN
  1121. ```
  1122. if normalize_variance == 1 && across_channels == 1 y = (x - mean) / (sqrt(var) + eps) of whole blob
  1123. if normalize_variance == 1 && across_channels == 0 y = (x - mean) / (sqrt(var) + eps) of each channel
  1124. if normalize_variance == 0 && across_channels == 1 y = x - mean of whole blob
  1125. if normalize_variance == 0 && across_channels == 0 y = x - mean of each channel
  1126. ```
  1127. * one_blob_only
  1128. | param id | name | type | default | description |
  1129. | --------- | ------------- | ----- | --------- | ----------------- |
  1130. | 0 | normalize_variance| int | 0 | |
  1131. | 1 | across_channels| int | 0 | |
  1132. | 2 | eps | float | 0.0001f | x = x / (sqrt(var) + eps) |
  1133. # Noop
  1134. ```
  1135. y = x
  1136. ```
  1137. # Normalize
  1138. ```
  1139. if across_spatial == 1 && across_channel == 1 x2 = normalize(x) of whole blob
  1140. if across_spatial == 1 && across_channel == 0 x2 = normalize(x) of each channel
  1141. if across_spatial == 0 && across_channel == 1 x2 = normalize(x) of each position
  1142. y = x2 * scale
  1143. ```
  1144. * one_blob_only
  1145. * support_inplace
  1146. | param id | name | type | default | description |
  1147. | --------- | ------------- | ----- | --------- | ----------------- |
  1148. | 0 | across_spatial| int | 0 | |
  1149. | 1 | channel_shared| int | 0 | |
  1150. | 2 | eps | float | 0.0001f | see eps mode |
  1151. | 3 | scale_data_size| int | 0 | |
  1152. | 4 | across_channel| int | 0 | |
  1153. | 9 | eps_mode | int | 0 | |
  1154. | weight | type | shape |
  1155. | ------------- | ----- | --------------------- |
  1156. | scale_data | float | [scale_data_size] |
  1157. Eps Mode:
  1158. - 0 = caffe/mxnet x = x / sqrt(var + eps)
  1159. - 1 = pytorch x = x / max(sqrt(var), eps)
  1160. - 2 = tensorflow x = x / sqrt(max(var, eps))
  1161. # Packing
  1162. ```
  1163. y = wrap_packing(x)
  1164. ```
  1165. * one_blob_only
  1166. | param id | name | type | default | description |
  1167. | --------- | ------------- | ----- | --------- | ----------------- |
  1168. | 0 | out_elempack | int | 1 | |
  1169. | 1 | use_padding | int | 0 | |
  1170. | 2 | cast_type_from| int | 0 | |
  1171. | 3 | cast_type_to | int | 0 | |
  1172. | 4 | storage_type_from| int | 0 | |
  1173. | 5 | storage_type_to| int | 0 | |
  1174. # Padding
  1175. ```
  1176. y = pad(x, pads)
  1177. ```
  1178. | param id | name | type | default | description |
  1179. | --------- | ------------- | ---- | --------- | ----------------- |
  1180. | 0 | top | int | 0 | |
  1181. | 1 | bottom | int | 0 | |
  1182. | 2 | left | int | 0 | |
  1183. | 3 | right | int | 0 | |
  1184. | 4 | type | int | 0 | |
  1185. | 5 | value | float | 0 | |
  1186. | 6 | per_channel_pad_data_size| int | 0 | |
  1187. | 7 | front | int | stride_w | |
  1188. | 8 | behind | int | pad_left | |
  1189. | weight | type | shape |
  1190. | ------------- | ----- | --------------------- |
  1191. | per_channel_pad_data| float | [per_channel_pad_data_size] |
  1192. Padding type:
  1193. - 0 = CONSTANT
  1194. - 1 = REPLICATE
  1195. - 2 = REFLECT
  1196. # Permute
  1197. ```
  1198. y = reorder(x)
  1199. ```
  1200. | param id | name | type | default | description |
  1201. | --------- | ------------- | ---- | --------- | ----------------- |
  1202. | 0 | order_type | int | 0 | |
  1203. Order Type:
  1204. - 0 = WH WHC WHDC
  1205. - 1 = HW HWC HWDC
  1206. - 2 = WCH WDHC
  1207. - 3 = CWH DWHC
  1208. - 4 = HCW HDWC
  1209. - 5 = CHW DHWC
  1210. - 6 = WHCD
  1211. - 7 = HWCD
  1212. - 8 = WCHD
  1213. - 9 = CWHD
  1214. - 10 = HCWD
  1215. - 11 = CHWD
  1216. - 12 = WDCH
  1217. - 13 = DWCH
  1218. - 14 = WCDH
  1219. - 15 = CWDH
  1220. - 16 = DCWH
  1221. - 17 = CDWH
  1222. - 18 = HDCW
  1223. - 19 = DHCW
  1224. - 20 = HCDW
  1225. - 21 = CHDW
  1226. - 22 = DCHW
  1227. - 23 = CDHW
  1228. # PixelShuffle
  1229. ```
  1230. if mode == 0 y = depth_to_space(x) where x channel order is sw-sh-outc
  1231. if mode == 1 y = depth_to_space(x) where x channel order is outc-sw-sh
  1232. ```
  1233. * one_blob_only
  1234. | param id | name | type | default | description |
  1235. | --------- | ------------- | ---- | --------- | ----------------- |
  1236. | 0 | upscale_factor| int | 1 | |
  1237. | 1 | mode | int | 0 | |
  1238. # Pooling
  1239. ```
  1240. x2 = pad(x, pads)
  1241. x3 = pooling(x2, kernel, stride)
  1242. ```
  1243. | param id | name | type | default | description |
  1244. | --------- | --------------| ---- | --------- | ----------------- |
  1245. | 0 | pooling_type | int | 0 | |
  1246. | 1 | kernel_w | int | 0 | |
  1247. | 2 | stride_w | int | 1 | |
  1248. | 3 | pad_left | int | 0 | |
  1249. | 4 | global_pooling| int | 0 | |
  1250. | 5 | pad_mode | int | 0 | |
  1251. | 6 | avgpool_count_include_pad| int | 0 | |
  1252. | 7 | adaptive_pooling| int | 0 | |
  1253. | 8 | out_w | int | 0 | |
  1254. | 11 | kernel_h | int | kernel_w | |
  1255. | 12 | stride_h | int | stride_w | |
  1256. | 13 | pad_top | int | pad_left | |
  1257. | 14 | pad_right | int | pad_left | |
  1258. | 15 | pad_bottom | int | pad_top | |
  1259. | 18 | out_h | int | out_w | |
  1260. Pooling type:
  1261. - 0 = MAX
  1262. - 1 = AVG
  1263. Pad mode:
  1264. - 0 = full padding
  1265. - 1 = valid padding
  1266. - 2 = tensorflow padding=SAME or onnx padding=SAME_UPPER
  1267. - 3 = onnx padding=SAME_LOWER
  1268. # Pooling1D
  1269. ```
  1270. x2 = pad(x, pads)
  1271. x3 = pooling1d(x2, kernel, stride)
  1272. ```
  1273. | param id | name | type | default | description |
  1274. | --------- | --------------| ---- | --------- | ----------------- |
  1275. | 0 | pooling_type | int | 0 | |
  1276. | 1 | kernel_w | int | 0 | |
  1277. | 2 | stride_w | int | 1 | |
  1278. | 3 | pad_left | int | 0 | |
  1279. | 4 | global_pooling| int | 0 | |
  1280. | 5 | pad_mode | int | 0 | |
  1281. | 6 | avgpool_count_include_pad| int | 0 | |
  1282. | 7 | adaptive_pooling| int | 0 | |
  1283. | 8 | out_w | int | 0 | |
  1284. | 14 | pad_right | int | pad_left | |
  1285. Pooling type:
  1286. - 0 = MAX
  1287. - 1 = AVG
  1288. Pad mode:
  1289. - 0 = full padding
  1290. - 1 = valid padding
  1291. - 2 = tensorflow padding=SAME or onnx padding=SAME_UPPER
  1292. - 3 = onnx padding=SAME_LOWER
  1293. # Pooling3D
  1294. ```
  1295. x2 = pad(x, pads)
  1296. x3 = pooling3d(x2, kernel, stride)
  1297. ```
  1298. | param id | name | type | default | description |
  1299. | --------- | --------------| ---- | --------- | ----------------- |
  1300. | 0 | pooling_type | int | 0 | |
  1301. | 1 | kernel_w | int | 0 | |
  1302. | 2 | stride_w | int | 1 | |
  1303. | 3 | pad_left | int | 0 | |
  1304. | 4 | global_pooling| int | 0 | |
  1305. | 5 | pad_mode | int | 0 | |
  1306. | 6 | avgpool_count_include_pad| int | 0 | |
  1307. | 7 | adaptive_pooling| int | 0 | |
  1308. | 8 | out_w | int | 0 | |
  1309. | 11 | kernel_h | int | kernel_w | |
  1310. | 12 | stride_h | int | stride_w | |
  1311. | 13 | pad_top | int | pad_left | |
  1312. | 14 | pad_right | int | pad_left | |
  1313. | 15 | pad_bottom | int | pad_top | |
  1314. | 16 | pad_behind | int | pad_front | |
  1315. | 18 | out_h | int | out_w | |
  1316. | 21 | kernel_d | int | kernel_w | |
  1317. | 22 | stride_d | int | stride_w | |
  1318. | 23 | pad_front | int | pad_left | |
  1319. | 28 | out_d | int | out_w | |
  1320. Pooling type:
  1321. - 0 = MAX
  1322. - 1 = AVG
  1323. Pad mode:
  1324. - 0 = full padding
  1325. - 1 = valid padding
  1326. - 2 = tensorflow padding=SAME or onnx padding=SAME_UPPER
  1327. - 3 = onnx padding=SAME_LOWER
  1328. # Power
  1329. ```
  1330. y = pow((shift + x * scale), power)
  1331. ```
  1332. * one_blob_only
  1333. * support_inplace
  1334. | param id | name | type | default | description |
  1335. | --------- | ------------- | ----- | --------- | ----------------- |
  1336. | 0 | power | float | 1.f | |
  1337. | 1 | scale | float | 1.f | |
  1338. | 2 | shift | float | 0.f | |
  1339. # PReLU
  1340. ```
  1341. if x < 0 y = x * slope
  1342. else y = x
  1343. ```
  1344. * one_blob_only
  1345. * support_inplace
  1346. | param id | name | type | default | description |
  1347. | --------- | ------------- | ----- | --------- | ----------------- |
  1348. | 0 | num_slope | int | 0 | |
  1349. | weight | type | shape |
  1350. | ------------- | ----- | --------------------- |
  1351. | slope_data | float | [num_slope] |
  1352. # Quantize
  1353. ```
  1354. y = float2int8(x * scale)
  1355. ```
  1356. * one_blob_only
  1357. | param id | name | type | default | description |
  1358. | --------- | ------------- | ----- | --------- | ----------------- |
  1359. | 0 | scale_data_size| int | 1 | |
  1360. | weight | type | shape |
  1361. | ------------- | ----- | --------------------- |
  1362. | scale_data | float | [scale_data_size] |
  1363. # Reduction
  1364. ```
  1365. y = reduce_op(x * coeff)
  1366. ```
  1367. * one_blob_only
  1368. | param id | name | type | default | description |
  1369. | --------- | ------------- | ----- | --------- | ----------------- |
  1370. | 0 | operation | int | 0 | |
  1371. | 1 | reduce_all | int | 1 | |
  1372. | 2 | coeff | float | 1.f | |
  1373. | 3 | axes | array | [ ] | |
  1374. | 4 | keepdims | int | 0 | |
  1375. | 5 | fixbug0 | int | 0 | hack for bug fix, should be 1 |
  1376. Operation type:
  1377. - 0 = SUM
  1378. - 1 = ASUM
  1379. - 2 = SUMSQ
  1380. - 3 = MEAN
  1381. - 4 = MAX
  1382. - 5 = MIN
  1383. - 6 = PROD
  1384. - 7 = L1
  1385. - 8 = L2
  1386. - 9 = LogSum
  1387. - 10 = LogSumExp
  1388. # ReLU
  1389. ```
  1390. if x < 0 y = x * slope
  1391. else y = x
  1392. ```
  1393. * one_blob_only
  1394. * support_inplace
  1395. | param id | name | type | default | description |
  1396. | --------- | ------------- | ----- | --------- | ----------------- |
  1397. | 0 | slope | float | 0.f | |
  1398. # Reorg
  1399. ```
  1400. if mode == 0 y = space_to_depth(x) where x channel order is sw-sh-outc
  1401. if mode == 1 y = space_to_depth(x) where x channel order is outc-sw-sh
  1402. ```
  1403. * one_blob_only
  1404. | param id | name | type | default | description |
  1405. | --------- | ------------- | ---- | --------- | ----------------- |
  1406. | 0 | stride | int | 1 | |
  1407. | 1 | mode | int | 0 | |
  1408. # Requantize
  1409. ```
  1410. x2 = x * scale_in + bias
  1411. x3 = activation(x2)
  1412. y = float2int8(x3 * scale_out)
  1413. ```
  1414. * one_blob_only
  1415. | param id | name | type | default | description |
  1416. | --------- | ------------- | ----- | --------- | ----------------- |
  1417. | 0 | scale_in_data_size| int | 1 | |
  1418. | 1 | scale_out_data_size| int | 1 | |
  1419. | 2 | bias_data_size| int | 0 | |
  1420. | 3 | activation_type| int | 0 | |
  1421. | 4 | activation_params| int | [ ] | |
  1422. | weight | type | shape |
  1423. | ------------- | ----- | --------------------- |
  1424. | scale_in_data | float | [scale_in_data_size] |
  1425. | scale_out_data| float | [scale_out_data_size] |
  1426. | bias_data | float | [bias_data_size] |
  1427. # Reshape
  1428. ```
  1429. if permute == 1 y = hwc2chw(reshape(chw2hwc(x)))
  1430. else y = reshape(x)
  1431. ```
  1432. * one_blob_only
  1433. | param id | name | type | default | description |
  1434. | --------- | ------------- | ----- | --------- | ----------------- |
  1435. | 0 | w | int | -233 | |
  1436. | 1 | h | int | -233 | |
  1437. | 11 | d | int | -233 | |
  1438. | 2 | c | int | -233 | |
  1439. | 3 | permute | int | 0 | |
  1440. Reshape flag:
  1441. - 0 = copy from bottom
  1442. - -1 = remaining
  1443. - -233 = drop this dim(default)
  1444. # RMSNorm
  1445. ```
  1446. split x along outmost axis into part x0, x1 ...
  1447. root mean square normalize for each part x0, x1 ...
  1448. y = x * gamma by elementwise
  1449. ```
  1450. * one_blob_only
  1451. * support_inplace
  1452. | param id | name | type | default | description |
  1453. | --------- | ------------- | ----- | --------- | ----------------- |
  1454. | 0 | affine_size | int | 0 | |
  1455. | 1 | eps | float | 0.001f | x = x / sqrt(var + eps) |
  1456. | 2 | affine | int | 1 | |
  1457. | weight | type | shape |
  1458. | ------------- | ----- | --------------------- |
  1459. | gamma_data | float | [affine_size] |
  1460. # RNN
  1461. 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]`.
  1462. ```
  1463. y = rnn(x)
  1464. y0, hidden y1 = rnn(x0, hidden x1)
  1465. ```
  1466. * one_blob_only if bidirectional
  1467. | param id | name | type | default | description |
  1468. | --------- | ------------- | ----- | --------- | ----------------- |
  1469. | 0 | num_output | int | 0 | hidden size of output |
  1470. | 1 | weight_data_size| int | 0 | total size of weight matrix |
  1471. | 2 | direction | int | 0 | 0=forward, 1=reverse, 2=bidirectional |
  1472. | weight | type | shape |
  1473. | ------------- | ----- | --------------------- |
  1474. | weight_xc_data| float/fp16/int8 | [input_size, num_output, num_directions] |
  1475. | bias_c_data | float/fp16/int8 | [num_output, 1, num_directions] |
  1476. | weight_hc_data| float/fp16/int8 | [num_output, num_output, num_directions] |
  1477. Direction flag:
  1478. - 0 = forward only
  1479. - 1 = reverse only
  1480. - 2 = bidirectional
  1481. # Scale
  1482. ```
  1483. if scale_data_size == -233 y = x0 * x1
  1484. else y = x * scale + bias
  1485. ```
  1486. * one_blob_only if scale_data_size != -233
  1487. * support_inplace
  1488. | param id | name | type | default | description |
  1489. | --------- | ------------- | ----- | --------- | ----------------- |
  1490. | 0 | scale_data_size| int | 0 | |
  1491. | 1 | bias_term | int | 0 | |
  1492. | weight | type | shape |
  1493. | ------------- | ----- | --------------------- |
  1494. | scale_data | float | [scale_data_size] |
  1495. | bias_data | float | [scale_data_size] |
  1496. # SELU
  1497. ```
  1498. if x < 0 y = (exp(x) - 1.f) * alpha * lambda
  1499. else y = x * lambda
  1500. ```
  1501. * one_blob_only
  1502. * support_inplace
  1503. | param id | name | type | default | description |
  1504. | --------- | ------------- | ----- | --------- | ----------------- |
  1505. | 0 | alpha | float | 1.67326324f| |
  1506. | 1 | lambda | float | 1.050700987f| |
  1507. # Shrink
  1508. ```
  1509. if x < -lambd y = x + bias
  1510. if x > lambd y = x - bias
  1511. else y = x
  1512. ```
  1513. * one_blob_only
  1514. * support_inplace
  1515. | param id | name | type | default | description |
  1516. | --------- | ------------- | ----- | --------- | ----------------- |
  1517. | 0 | bias | float | 0.0f | |
  1518. | 1 | lambd | float | 0.5f | |
  1519. # ShuffleChannel
  1520. ```
  1521. if reverse == 0 y = shufflechannel(x) by group
  1522. if reverse == 1 y = shufflechannel(x) by channel / group
  1523. ```
  1524. * one_blob_only
  1525. | param id | name | type | default | description |
  1526. | --------- | ------------- | ---- | --------- | ----------------- |
  1527. | 0 | group | int | 1 | |
  1528. | 1 | reverse | int | 0 | |
  1529. # Sigmoid
  1530. ```
  1531. y = 1 / (1 + exp(-x))
  1532. ```
  1533. * one_blob_only
  1534. * support_inplace
  1535. # Slice
  1536. ```
  1537. split x along axis into slices, each part slice size is based on slices array
  1538. ```
  1539. | param id | name | type | default | description |
  1540. | --------- | ------------- | ----- | --------- | ----------------- |
  1541. | 0 | slices | array | [ ] | |
  1542. | 1 | axis | int | 0 | |
  1543. | 2 | indices | array | [ ] | |
  1544. # Softmax
  1545. ```
  1546. softmax(x, axis)
  1547. ```
  1548. * one_blob_only
  1549. * support_inplace
  1550. | param id | name | type | default | description |
  1551. | --------- | ------------- | ----- | --------- | ----------------- |
  1552. | 0 | axis | int | 0 | |
  1553. | 1 | fixbug0 | int | 0 | hack for bug fix, should be 1 |
  1554. # Softplus
  1555. ```
  1556. y = log(exp(x) + 1)
  1557. ```
  1558. * one_blob_only
  1559. * support_inplace
  1560. # Spectrogram
  1561. ```
  1562. x1 = pad(x) if center
  1563. y = stft(x1)
  1564. y = y / sqrt(norm) if normalized
  1565. if power == 0 return y as real
  1566. if power == 1 return magnitude
  1567. if power == 2 return square of magnitude
  1568. ```
  1569. * one_blob_only
  1570. | param id | name | type | default | description |
  1571. | --------- | ------------- | ----- | --------- | ----------------- |
  1572. | 0 | n_fft | int | 0 | |
  1573. | 1 | power | int | 0 | |
  1574. | 2 | hoplen | int | n_fft / 4 | |
  1575. | 3 | winlen | int | n_fft | |
  1576. | 4 | window_type | int | 0 | 0=ones 1=hann 2=hamming |
  1577. | 5 | center | int | 1 | |
  1578. | 6 | pad_type | int | 2 | 0=CONSTANT 1=REPLICATE 2=REFLECT |
  1579. | 7 | normalized | int | 0 | 0=no 1=n_fft 2=window-l2-energy |
  1580. | 8 | onesided | int | 1 | |
  1581. # Split
  1582. ```
  1583. y0, y1 ... = x
  1584. ```
  1585. # Swish
  1586. ```
  1587. y = x / (1 + exp(-x))
  1588. ```
  1589. * one_blob_only
  1590. * support_inplace
  1591. # TanH
  1592. ```
  1593. y = tanh(x)
  1594. ```
  1595. * one_blob_only
  1596. * support_inplace
  1597. # Threshold
  1598. ```
  1599. if x > threshold y = 1
  1600. else y = 0
  1601. ```
  1602. * one_blob_only
  1603. * support_inplace
  1604. | param id | name | type | default | description |
  1605. | --------- | ------------- | ----- | --------- | ----------------- |
  1606. | 0 | threshold | float | 0.f | |
  1607. # Tile
  1608. ```
  1609. y = repeat tiles along axis for x
  1610. ```
  1611. * one_blob_only
  1612. | param id | name | type | default | description |
  1613. | --------- | ------------- | ----- | --------- | ----------------- |
  1614. | 0 | axis | int | 0 | |
  1615. | 1 | tiles | int | 1 | |
  1616. | 2 | repeats | array | [ ] | |
  1617. # UnaryOp
  1618. ```
  1619. y = unaryop(x)
  1620. ```
  1621. - one_blob_only
  1622. - support_inplace
  1623. | param id | name | type | default | description |
  1624. | --------- | ------------- | ----- | --------- | ----------------- |
  1625. | 0 | op_type | int | 0 | Operation type as follows |
  1626. Operation type:
  1627. - 0 = ABS
  1628. - 1 = NEG
  1629. - 2 = FLOOR
  1630. - 3 = CEIL
  1631. - 4 = SQUARE
  1632. - 5 = SQRT
  1633. - 6 = RSQ
  1634. - 7 = EXP
  1635. - 8 = LOG
  1636. - 9 = SIN
  1637. - 10 = COS
  1638. - 11 = TAN
  1639. - 12 = ASIN
  1640. - 13 = ACOS
  1641. - 14 = ATAN
  1642. - 15 = RECIPROCAL
  1643. - 16 = TANH
  1644. - 17 = LOG10
  1645. - 18 = ROUND
  1646. - 19 = TRUNC
  1647. # Unfold
  1648. ```
  1649. y = unfold(x)
  1650. ```
  1651. * one_blob_only
  1652. | param id | name | type | default | description |
  1653. | --------- | ------------- | ----- | --------- | ----------------- |
  1654. | 0 | num_output | int | 0 | |
  1655. | 1 | kernel_w | int | 0 | |
  1656. | 2 | dilation_w | int | 1 | |
  1657. | 3 | stride_w | int | 1 | |
  1658. | 4 | pad_left | int | 0 | |
  1659. | 11 | kernel_h | int | kernel_w | |
  1660. | 12 | dilation_h | int | dilation_w | |
  1661. | 13 | stride_h | int | stride_w | |
  1662. | 14 | pad_top | int | pad_left | |
  1663. | 15 | pad_right | int | pad_left | |
  1664. | 16 | pad_bottom | int | pad_top | |