-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapu_uint8_int16_2.patch
56 lines (56 loc) · 2.79 KB
/
apu_uint8_int16_2.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
diff --git a/mace/tools/mace_run.cc b/mace/tools/mace_run.cc
index 0cf14c7..93b18d0 100644
--- a/mace/tools/mace_run.cc
+++ b/mace/tools/mace_run.cc
@@ -217,10 +217,15 @@ std::shared_ptr<char> ReadInputDataFromFile(
reinterpret_cast<BFloat16 *>(input_data.get()), tensor_size);
#endif // MACE_ENABLE_BFLOAT16
#ifdef MACE_ENABLE_MTK_APU
- } else if (input_data_type == IDT_INT16 || input_data_type == IDT_UINT8) {
- // TODO(luxuhui): Quantize it
- mace::ops::CopyDataBetweenSameType(
- nullptr, buffer_in.get(), input_data.get(), input_size);
+ } else if (input_data_type == IDT_INT16) {
+ mace::ops::CopyDataBetweenDiffType(
+ nullptr, reinterpret_cast<const float *>(buffer_in.get()),
+ reinterpret_cast<int16_t *>(input_data.get()), tensor_size);
+ } else if (input_data_type == IDT_UINT8) {
+ LOG(INFO) << "read uint8 data from file";
+ mace::ops::CopyDataBetweenDiffType(
+ nullptr, reinterpret_cast<const float *>(buffer_in.get()),
+ reinterpret_cast<uint8_t *>(input_data.get()), tensor_size);
#endif // MACE_ENABLE_MTK_APU
} else {
LOG(FATAL) << "Input data type " << input_data_type << " is not supported.";
@@ -258,10 +263,15 @@ int64_t WriteOutputDataToFile(const std::string &file_path,
reinterpret_cast<float *>(tmp_output.data()), output_size);
#endif // MACE_ENABLE_BFLOAT16
#ifdef MACE_ENABLE_MTK_APU
- } else if (output_data_type == IDT_UINT8 || output_data_type == IDT_INT16) {
- // TODO(luxuhui): Dequantize it
- mace::ops::CopyDataBetweenSameType(
- nullptr, output_data.get(), tmp_output.data(), output_bytes);
+ } else if (file_data_type == IDT_FLOAT && output_data_type == IDT_UINT8) {
+ LOG(INFO) << "write uint8 data to file";
+ mace::ops::CopyDataBetweenDiffType(
+ nullptr, reinterpret_cast<const uint8_t *>(output_data.get()),
+ reinterpret_cast<float *>(tmp_output.data()), output_size);
+ } else if (file_data_type == IDT_FLOAT && output_data_type == IDT_INT16) {
+ mace::ops::CopyDataBetweenDiffType(
+ nullptr, reinterpret_cast<const int16_t *>(output_data.get()),
+ reinterpret_cast<float *>(tmp_output.data()), output_size);
#endif // MACE_ENABLE_MTK_APU
} else {
LOG(FATAL) << "Output data type " << output_data_type <<
diff --git a/micro/third_party/CMSIS_5 b/micro/third_party/CMSIS_5
--- a/micro/third_party/CMSIS_5
+++ b/micro/third_party/CMSIS_5
@@ -1 +1 @@
-Subproject commit 378acfb6490a82ba90e1ffb4bfd4e602668b180a
+Subproject commit 378acfb6490a82ba90e1ffb4bfd4e602668b180a-dirty
diff --git a/micro/third_party/googletest b/micro/third_party/googletest
--- a/micro/third_party/googletest
+++ b/micro/third_party/googletest
@@ -1 +1 @@
-Subproject commit e6e2d3b7614ff4e6017d8968bd4c3f579133666e
+Subproject commit e6e2d3b7614ff4e6017d8968bd4c3f579133666e-dirty