Skip to content

Commit bd91b47

Browse files
author
Michael O'Cleirigh
committed
[microlite] update for post micropython 1.20.0 module changes
1 parent 13063c8 commit bd91b47

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

micropython-modules/microlite/tensorflow-microlite.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ STATIC mp_obj_t tensor_get_tensor_type (mp_obj_t self_in, mp_obj_t index_obj) {
7070

7171
TfLiteTensor * tensor = (TfLiteTensor *)self->tf_tensor;
7272

73-
char *type = TfLiteTypeGetName(tensor->type);
73+
const char *type = TfLiteTypeGetName(tensor->type);
7474

7575
return mp_obj_new_str(type, strlen(type));
7676

@@ -212,13 +212,13 @@ STATIC const mp_rom_map_elem_t tensor_locals_dict_table[] = {
212212

213213
STATIC MP_DEFINE_CONST_DICT(tensor_locals_dict, tensor_locals_dict_table);
214214

215-
const mp_obj_type_t microlite_tensor_type = {
216-
{ &mp_type_type },
217-
.name = MP_QSTR_tensor,
218-
.print = tensor_print,
219-
.locals_dict = (mp_obj_dict_t*)&tensor_locals_dict,
220-
};
221-
215+
MP_DEFINE_CONST_OBJ_TYPE(
216+
microlite_tensor_type,
217+
MP_QSTR_tensor,
218+
MP_TYPE_FLAG_NONE,
219+
print, tensor_print,
220+
locals_dict,&tensor_locals_dict
221+
);
222222
// audio_frontend
223223

224224
STATIC mp_obj_t af_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
@@ -261,13 +261,14 @@ STATIC const mp_rom_map_elem_t audio_frontend_locals_dict_table[] = {
261261

262262
STATIC MP_DEFINE_CONST_DICT(audio_frontend_locals_dict, audio_frontend_locals_dict_table);
263263

264-
const mp_obj_type_t microlite_audio_frontend_type = {
265-
{ &mp_type_type },
266-
.name = MP_QSTR_audio_frontend,
267-
.make_new = af_make_new,
268-
.print = af_print,
269-
.locals_dict = (mp_obj_dict_t*)&audio_frontend_locals_dict,
270-
};
264+
MP_DEFINE_CONST_OBJ_TYPE(
265+
microlite_audio_frontend_type,
266+
MP_QSTR_audio_frontend,
267+
MP_TYPE_FLAG_NONE,
268+
make_new, af_make_new,
269+
print, af_print,
270+
locals_dict, &audio_frontend_locals_dict
271+
);
271272

272273
// - microlite interpreter
273274

@@ -411,14 +412,14 @@ STATIC const mp_rom_map_elem_t interpreter_locals_dict_table[] = {
411412

412413
STATIC MP_DEFINE_CONST_DICT(interpreter_locals_dict, interpreter_locals_dict_table);
413414

414-
const mp_obj_type_t microlite_interpreter_type = {
415-
{ &mp_type_type },
416-
.name = MP_QSTR_interpreter,
417-
.print = interpreter_print,
418-
.make_new = interpreter_make_new,
419-
.locals_dict = (mp_obj_dict_t*)&interpreter_locals_dict,
420-
};
421-
415+
MP_DEFINE_CONST_OBJ_TYPE(
416+
microlite_interpreter_type,
417+
MP_QSTR_interpreter,
418+
MP_TYPE_FLAG_NONE,
419+
print, interpreter_print,
420+
make_new, interpreter_make_new,
421+
locals_dict, &interpreter_locals_dict
422+
);
422423

423424
// main microlite module
424425

@@ -451,4 +452,3 @@ const mp_obj_module_t microlite_cmodule = {
451452
MP_REGISTER_MODULE(MP_QSTR_microlite, microlite_cmodule);
452453

453454
// #endif
454-

0 commit comments

Comments
 (0)