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

operators.md 72 kB

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