| 82 | dtype_map.setdefault(v, k) |
| 83 | |
| 84 | def fill_tensor_info(info, qnn_tensors, category): |
| 85 | for tensor in qnn_tensors: |
| 86 | encoding = tensor.GetEncodings() |
| 87 | quantization_info = { |
| 88 | "scale": encoding.data["scale"].tolist(), |
| 89 | "offset": encoding.data["offset"].tolist(), |
| 90 | "axis": encoding.axis, |
| 91 | } |
| 92 | |
| 93 | info[category].append( |
| 94 | { |
| 95 | "name": tensor.GetName(), |
| 96 | "shape": tensor.GetDims().tolist(), |
| 97 | "dtype": dtype_map[tensor.GetDataType()], |
| 98 | "encoding": quantization_info, |
| 99 | } |
| 100 | ) |
| 101 | |
| 102 | in_key, out_key = "inputs", "outputs" |
| 103 | tensor_info = {in_key: [], out_key: []} |