Merge pull request #2286 from openmv/ml_model_addr

modules/py_ml: Add tensor area memory address to model object.
This commit is contained in:
Ibrahim Abdelkader 2024-07-16 11:50:12 +02:00 committed by GitHub
commit 5b85cee97c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 2 deletions

View File

@ -286,6 +286,7 @@ int ml_backend_init_model(py_ml_model_obj_t *model) {
}
model->state = state;
model->memory_addr = (uint32_t) state->arena;
return 0;
}

View File

@ -165,7 +165,7 @@ static mp_obj_t py_ml_dtype_char_tuple(const mp_obj_tuple_t *dtype) {
static void py_ml_model_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
py_ml_model_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "{size: %d, ram: %d", self->size, self->memory_size);
mp_printf(print, "{ size: %d, ram: %d, addr: 0x%x", self->size, self->memory_size, self->memory_addr);
mp_printf(print, ", input_shape: ");
mp_obj_print_helper(print, self->input_shape, kind);
mp_printf(print, ", input_scale: ");

View File

@ -16,6 +16,7 @@ typedef struct py_ml_model_obj {
unsigned int size;
unsigned char *data;
size_t memory_size;
uint32_t memory_addr;
bool fb_alloc;
size_t inputs_size;
mp_obj_tuple_t *input_shape;