实现cnn计算功能,修复switchdata的bug

This commit is contained in:
Qiea
2024-11-11 12:28:33 +08:00
parent fe062deba5
commit 0af7f203c7
5 changed files with 150 additions and 111 deletions

View File

@@ -194,8 +194,12 @@ u8 model_write(char* model_name)
return 200;
}
sprintf(_path, "./dataset/%s.txt", _model -> name);
sprintf(_path, "./dataset/%s.txt", _model -> dname ? _model -> dname : _model -> name);
FILE *file = fopen(_path, "r");
if(file == NULL){
DEBUG_PRINTF("文件[%s]无法打开\r\n", _model -> dname ? _model -> dname : _model -> name);
return 199;
}
DEBUG_PRINTF("写入的模型参数名字是:%s\r\n", _model -> name);
if(_model -> dname)DEBUG_PRINTF("写入的Data数据集是%s\r\n", _model -> dname);
@@ -227,9 +231,9 @@ u8 model_write(char* model_name)
if(_larr >= _model -> maxlength)break;
}
DEBUG_PRINTF("\r\n模型参数[%s]已写入到内存中! 模型长度为 %d\r\n",_model -> dname ? _model -> dname : _model -> name,_model -> realength);
return 1;
return 0;
}
return 0;
return 1;
}
@@ -273,7 +277,7 @@ u8 model_switchdata(char* data_name){
return 0;
}else{
u8 _res = model_write(data_name);
if (_res == 0) {
if (_res) {
DEBUG_PRINTF("Data数据集[%s]切换失败!!\r\n",data_name);
return 0;
}