Skip to content

Commit 3817c2a

Browse files
Add model data attribute: const (tensorflow#147)
On most Arduino platforms, this will ensure the model is stored in flash memory. bug=fixes #142 Co-authored-by: Advait Jain <[email protected]>
1 parent 22815dc commit 3817c2a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

examples/magic_wand/magic_wand_model_data.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ See the License for the specific language governing permissions and
1010
limitations under the License.
1111
==============================================================================*/
1212

13-
unsigned char g_magic_wand_model_data[] = {
13+
#include "magic_wand_model_data.h"
14+
15+
const unsigned char g_magic_wand_model_data[] = {
1416
0x20, 0x00, 0x00, 0x00, 0x54, 0x46, 0x4c, 0x33, 0x00, 0x00, 0x00, 0x00,
1517
0x14, 0x00, 0x20, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x10, 0x00,
1618
0x14, 0x00, 0x00, 0x00, 0x18, 0x00, 0x1c, 0x00, 0x14, 0x00, 0x00, 0x00,
@@ -2585,4 +2587,5 @@ unsigned char g_magic_wand_model_data[] = {
25852587
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00,
25862588
0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x00, 0x04, 0x00,
25872589
0x04, 0x00, 0x00, 0x00};
2588-
unsigned int g_magic_wand_model_data_len = 30880;
2590+
2591+
const int g_magic_wand_model_data_len = sizeof(g_magic_wand_model_data);

examples/magic_wand/magic_wand_model_data.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ limitations under the License.
2121
extern const unsigned char g_magic_wand_model_data[];
2222
extern const int g_magic_wand_model_data_len;
2323

24-
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_MAGIC_WAND_MODEL_DATA_H_
24+
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_MAGIC_WAND_MODEL_DATA_H_

0 commit comments

Comments
 (0)