conv2d_s4_weights_template.json 2.7 KB

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