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

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