How can I handle multiple outputs networks?
The approach described on the official XCUBE-AI documentation is not working for my case.
The approach described on the official XCUBE-AI documentation is not working for my case.
Hello,
According the shared code, I think that you have an issue when you initalize the ai_buffer handlers before to call the ai_network_run() function. The passed @ are not correct, "in_data" and "out_data" are the array of pointer, code should be modified as follow:
aiConvertInputFloat_2_Int8(input, in_data);
/* ai_inputs[0].data = AI_HANDLE_PTR(&in_data[0]); */
ai_inputs[0].data = AI_HANDLE_PTR(in_data[0]);
/* Update the AI output handlers */
for (int i=0; i < AI_NETWORK_OUT_NUM; i++) {
/* ai_outputs[i].data = AI_HANDLE_PTR(&out_data[i]); */
ai_outputs[i].data = AI_HANDLE_PTR(out_data[i]);
}Note that is also recommended to align the IO buffer:
/* C-table to store the @ of the input buffer */
AI_ALIGNED(32)
static ai_i8 in_data[AI_NETWORK_IN_1_SIZE];
/* AI input/output handlers */
static ai_buffer *ai_inputs;
static ai_buffer *ai_outputs;
/* data buffer for the output buffers */
AI_ALIGNED(32)
static ai_i8 out_1_data[AI_NETWORK_OUT_1_SIZE];
AI_ALIGNED(32)
static ai_i8 out_2_data[AI_NETWORK_OUT_2_SIZE];Best,
Jean-Michel
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.