fix maskrcnn and fasterrcnn 310 bug

This commit is contained in:
yuzhenhua 2021-03-29 14:29:08 +08:00
parent 52730382b2
commit d0be1353c3
2 changed files with 17 additions and 2 deletions

View File

@ -169,7 +169,15 @@ int AclProcess::WriteResult(const std::string& imageFile) {
std::cout << "open result file " << outFileName << " failed" << std::endl;
return INVALID_POINTER;
}
fwrite(resHostBuf, output_size, sizeof(char), outputFile);
size_t size = fwrite(resHostBuf, sizeof(char), output_size, outputFile);
if (size != output_size) {
fclose(outputFile);
outputFile = nullptr;
std::cout << "write result file " << outFileName << " failed, write size[" << size <<
"] is smaller than output size[" << output_size << "], maybe the disk is full." << std::endl;
return ERROR;
}
fclose(outputFile);
outputFile = nullptr;
} catch (std::exception &e) {

View File

@ -169,7 +169,14 @@ int AclProcess::WriteResult(const std::string& imageFile) {
std::cout << "open result file " << outFileName << " failed" << std::endl;
return INVALID_POINTER;
}
fwrite(resHostBuf, output_size, sizeof(char), outputFile);
size_t size = fwrite(resHostBuf, sizeof(char), output_size, outputFile);
if (size != output_size) {
fclose(outputFile);
outputFile = nullptr;
std::cout << "write result file " << outFileName << " failed, write size[" << size <<
"] is smaller than output size[" << output_size << "], maybe the disk is full." << std::endl;
return ERROR;
}
fclose(outputFile);
outputFile = nullptr;
} catch (std::exception &e) {