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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. * [absval](#absval)
  2. * [argmax](#argmax)
  3. * [batchnorm](#batchnorm)
  4. * [bias](#bias)
  5. * [clip](#clip)
  6. * [concat](#concat)
  7. * [convolution](#convolution)
  8. * [dequantize](#dequantize)
  9. * [lstm](#lstm)
  10. * [softmax](#softmax)
  11. # absval
  12. ```
  13. y = abs(x)
  14. ```
  15. * one_blob_only
  16. * support_inplace
  17. # argmax
  18. ```
  19. y = argmax(x, out_max_val, topk)
  20. ```
  21. * one_blob_only
  22. |param id|name|type|default|
  23. |--|--|--|--|
  24. |0|out_max_val|int|0|
  25. |1|topk|int|1|
  26. # batchnorm
  27. ```
  28. y = (x - mean) / sqrt(var + eps) * slope + bias
  29. ```
  30. * one_blob_only
  31. * support_inplace
  32. |param id|name|type|default|
  33. |--|--|--|--|
  34. |0|channels|int|0|
  35. |1|eps|float|0.f|
  36. |weight|type|
  37. |--|--|
  38. |slope_data|float|
  39. |mean_data|float|
  40. |var_data|float|
  41. |bias_data|float|
  42. # bias
  43. ```
  44. y = x + bias
  45. ```
  46. * one_blob_only
  47. * support_inplace
  48. |param id|name|type|default|
  49. |--|--|--|--|
  50. |0|bias_data_size|int|0|
  51. |weight|type|
  52. |--|--|
  53. |bias_data|float|
  54. # clip
  55. ```
  56. y = clamp(x, min, max)
  57. ```
  58. * one_blob_only
  59. * support_inplace
  60. |param id|name|type|default|
  61. |--|--|--|--|
  62. |0|min|float|-FLT_MAX|
  63. |1|max|float|FLT_MAX|
  64. # concat
  65. ```
  66. y = concat(x0, x1, x2, ...) by axis
  67. ```
  68. |param id|name|type|default|
  69. |--|--|--|--|
  70. |0|axis|int|0|
  71. # convolution
  72. ```
  73. x2 = pad(x, pads, pad_value)
  74. x3 = conv(x2, weight, kernel, stride, dilation) + bias
  75. y = activation(x3, act_type, act_params)
  76. ```
  77. * one_blob_only
  78. |param id|name|type|default|
  79. |--|--|--|--|
  80. |0|num_output|int|0|
  81. |1|kernel_w|int|0|
  82. |2|dilation_w|int|1|
  83. |3|stride_w|int|1|
  84. |4|pad_left|int|0|
  85. |5|bias_term|int|0|
  86. |6|weight_data_size|int|0|
  87. |8|int8_scale_term|int|0|
  88. |9|activation_type|int|0|
  89. |10|activation_params|array|[ ]|
  90. |11|kernel_h|int|kernel_w|
  91. |12|dilation_h|int|dilation_w|
  92. |13|stride_h|int|stride_w|
  93. |15|pad_right|int|pad_left|
  94. |14|pad_top|int|pad_left|
  95. |16|pad_bottom|int|pad_top|
  96. |18|pad_value|float|0.f|
  97. |weight|type|
  98. |--|--|
  99. |weight_data|float/fp16/int8|
  100. |bias_data|float|
  101. # dequantize
  102. ```
  103. y = x * scale + bias
  104. ```
  105. * one_blob_only
  106. * support_inplace
  107. |param id|name|type|default|
  108. |--|--|--|--|
  109. |0|scale|float|1.f|
  110. |1|bias_term|int|0|
  111. |2|bias_data_size|int|0|
  112. # lstm
  113. 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]`.
  114. * one_blob_only
  115. |param id|name|type|default|description|
  116. |--|--|--|--|--|
  117. |0|num_output|int|0|hidden size of output|
  118. |1|weight_data_size|int|0|total size of IFOG weight matrix|
  119. |2|direction|int|0|0=forward, 1=reverse, 2=bidirectional|
  120. |weight|type|shape|description|
  121. |--|--|--|--|--|--|
  122. |weight_xc_data|float|`[w=input_size, h=num_output * 4, c=num_directions]`||
  123. |bias_c_data|float|`[w=num_output, h=4, c=num_directions]`||
  124. |weight_hc_data|float|`[w=num_output, h=num_output * 4, c=num_directions]`||
  125. # softmax
  126. ```
  127. softmax(x, axis)
  128. ```
  129. * one_blob_only
  130. * support_inplace
  131. |param id|name|type|default|description|
  132. |--|--|--|--|--|
  133. |0|axis|int|0||
  134. |1|fixbug0|int|0|hack for bug fix, should be 1|