fc_weights_template.json 2.7 KB

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