Skip to main content
Associate II
March 19, 2024
Question

identifier "AI_AI_DATA_ACTIVATION_1_SIZE" is undefined

  • March 19, 2024
  • 3 replies
  • 3196 views

..\..\AI\X-CUBE-AI\App\app_x-cube-ai.c(93):error: #20: identifier "AI_AI_DATA_ACTIVATION_1_SIZE" is undefined
static uint8_t poo10[AI_AI_DATA_ACTIVATION_1_SIZE];

...\...\AI\X-CUBE-AI\App\app_x-cube-ai.c(95): error: #28: expression must have a constant value
ai_handle data_activations0[ ] = {poo10};

 

thank u!!!!!!!!

3 replies

Andrew Neil
Super User
March 19, 2024

Have you done a search to see if any definition of "AI_AI_DATA_ACTIVATION_1_SIZE" does exist anywhere?

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
SunjingAuthor
Associate II
March 19, 2024

yes,

微信图片_20240319230123.png

''AI_AI_DATA_ACTIVATION_1_SIZE'' , It only exists in ‘’app_x-cube-ai.c‘’ this file, there is no definition,

and there have two files in lib

微信图片_20240319230117.png

 

when I use sklearn-onnx generate a file

 

initial_type = [('float_input', FloatTensorType([1, 270]))]
model_onnx = convert_sklearn(clf, initial_types=initial_type)
with open("adaboost-270-1.onnx", "wb") as f:
f.write(model_onnx.SerializeToString())

I'm not sure if it's because of this place bug:initial_type = [('float_input', FloatTensorType([1, 270]))]

fauvarque.daniel
ST Employee
March 19, 2024

The correct constant is probably AI_DATA_ACTIVATION_1_SIZE

I don't know why you have twice AI_

SunjingAuthor
Associate II
March 19, 2024

..\..\AI\X-CUBE-AI\App\app_x-cube-ai.c(93):error: #20: identifier "AI_AI_DATA_ACTIVATION_1_SIZE" is undefined
static uint8_t poo10[AI_AI_DATA_ACTIVATION_1_SIZE];

...\...\AI\X-CUBE-AI\App\app_x-cube-ai.c(95): error: #28: expression must have a constant value
ai_handle data_activations0[ ] = {poo10};

 

but I don't know how to fix this issue

Andrew Neil
Super User
March 19, 2024

The second error:

...\...\AI\X-CUBE-AI\App\app_x-cube-ai.c(95): error: #28: expression must have a constant value
ai_handle data_activations0[ ] = {poo10};

Is clearly a result of the first error:

..\..\AI\X-CUBE-AI\App\app_x-cube-ai.c(93):error: #20: identifier "AI_AI_DATA_ACTIVATION_1_SIZE" is undefined
static uint8_t poo10[AI_AI_DATA_ACTIVATION_1_SIZE];

 

The first error causes your definition of poo10 to be invalid - therefore you get the 2nd error when you try to use poo10.

Thus one fix will solve both errors.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
fauvarque.daniel
ST Employee
March 19, 2024

Correction, you probably named your network AI that's why the constant is like that 

 

it is defined in the network_data_params.h file (or ai_data_params.h probably in your case)

SunjingAuthor
Associate II
March 19, 2024

I didn't find this in file

global search didn't find anything
This parameter is only present at the invocation point and has not been defined, which is why it is reported

when I use sklearn-onnx generate a file

initial_type = [('float_input', FloatTensorType([1, 270]))]
model_onnx = convert_sklearn(clf, initial_types=initial_type)
with open("adaboost-270-1.onnx", "wb") as f:
 f.write(model_onnx.SerializeToString())

The first time I used the following code

 initial_type = [('float_input', FloatTensorType([None, 2]))] 

can success, but the input data for the algorithm model is 1x270

so I changed the code to

initial_type = [('float_input', FloatTensorType([1, 270]))]

but when I use this code.

This problem has occurred

【..\..\AI\X-CUBE-AI\App\app_x-cube-ai.c(93):error: #20: identifier "AI_AI_DATA_ACTIVATION_1_SIZE" is undefined
static uint8_t poo10[AI_AI_DATA_ACTIVATION_1_SIZE];

...\...\AI\X-CUBE-AI\App\app_x-cube-ai.c(95): error: #28: expression must have a constant value
ai_handle data_activations0[ ] = {poo10};】

SunjingAuthor
Associate II
March 19, 2024

Is there an error generating the [.onnx] model file