dw_s4_weights_template.json 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. {
  2. "version": 3,
  3. "operator_codes": [
  4. {
  5. "deprecated_builtin_code": 4,
  6. "version": 1,
  7. "builtin_code": "DEPTHWISE_CONV_2D"
  8. }
  9. ],
  10. "subgraphs": [
  11. {
  12. "tensors": [
  13. {
  14. "shape": [
  15. batches,
  16. input_y,
  17. input_x,
  18. input_ch
  19. ],
  20. "type": "INT8",
  21. "buffer": 1,
  22. "quantization": {
  23. "scale": [
  24. input_scale
  25. ],
  26. "zero_point": [
  27. input_zp
  28. ],
  29. "quantized_dimension": 0
  30. },
  31. "is_variable": false
  32. },
  33. {
  34. "shape": [
  35. 1,
  36. weight_y,
  37. weight_x,
  38. output_ch
  39. ],
  40. "type": "INT4",
  41. "buffer": 2,
  42. "quantization": {
  43. "scale": w_scale,
  44. "zero_point": w_zp,
  45. "quantized_dimension": 3
  46. },
  47. "is_variable": false
  48. },
  49. {
  50. "shape": [
  51. output_ch
  52. ],
  53. "type": "INT32",
  54. "buffer": 3,
  55. "quantization": {
  56. "scale": bias_scale,
  57. "zero_point": bias_zp,
  58. "quantized_dimension": 0
  59. },
  60. "is_variable": false
  61. },
  62. {
  63. "shape": [
  64. batches,
  65. output_y,
  66. output_x,
  67. output_ch
  68. ],
  69. "type": "INT8",
  70. "buffer": 4,
  71. "quantization": {
  72. "scale": [
  73. output_scale
  74. ],
  75. "zero_point": [
  76. output_zp
  77. ],
  78. "quantized_dimension": 0
  79. },
  80. "is_variable": false
  81. }
  82. ],
  83. "inputs": [
  84. 0
  85. ],
  86. "outputs": [
  87. 3
  88. ],
  89. "operators": [
  90. {
  91. "opcode_index": 0,
  92. "inputs": [
  93. 0,
  94. 1,
  95. 2
  96. ],
  97. "outputs": [
  98. 3
  99. ],
  100. "builtin_options_type": "DepthwiseConv2DOptions",
  101. "builtin_options": {
  102. "padding": "type_pad",
  103. "stride_w": stride_x,
  104. "stride_h": stride_y,
  105. "depth_multiplier": ch_mult,
  106. "fused_activation_function": "NONE",
  107. "dilation_w_factor": dilation_x,
  108. "dilation_h_factor": dilation_y
  109. },
  110. "custom_options_format": "FLEXBUFFERS"
  111. }
  112. ]
  113. }
  114. ],
  115. "buffers": [
  116. {
  117. },
  118. {
  119. },
  120. {
  121. "data": [
  122. ]
  123. },
  124. {
  125. "data": [
  126. ]
  127. },
  128. {
  129. }
  130. ]
  131. }