Showing results for 
Search instead for 
Did you mean: 

Debugging problem

Associate II


I generated the C-code for my AI model using Cube AI, and I'm struggling with how to correctly set up the function calls and everything to initialize & run my model on Cube IDE. I made these first lines to verify if the returns were working fine for the initialization part:

ai_handle myNetwork = NULL;
ai_network_params params;
ai_error err;

err = ai_network_create(&myNetwork, AI_NETWORK_DATA_CONFIG);
if (err.type == AI_ERROR_NONE) printf("Network instance created\r\n");
if (ai_network_data_params_get(&params)) printf("Valid configuration is present\r\n");
if(ai_network_init(myNetwork, &params)) printf("Network initialized\r\n");

When debugging, I could get the proper return for the ai_network_create and ai_network_data_params_get, but I wasn't being able to initialize the network. Going further, I saw inside ai_network_init declaration:

ai_bool ai_network_init(
ai_handle network, const ai_network_params* params)
ai_network* net_ctx = ai_platform_network_init(network, params);
if (!net_ctx) return false;

ai_bool ok = true;
ok &= network_configure_weights(net_ctx, params);
ok &= network_configure_activations(net_ctx, params);

ok &= ai_platform_network_post_init(network);

return ok;

And in my case, the problem happens on the line "ok &= network_configure_activations(net_ctx, params)", where ok goes back to false. Going inside this function as well, I found the origin of the problem:

"if (ai_platform_get_activations_map(g_network_activations_map, 1, params)) {"

This condition is false. In order to work properly, it should be true. This is declared in the function "ai_platform_interface.h" as follows:

ai_bool ai_platform_get_activations_map(
ai_ptr* map, const ai_size map_size, const ai_network_params* params);


I don't know exactly how to proceed to solve this issue, and in general I'm struggling to set up the functions to run my model. Could someone help me please? Thanks!