forked from mindspore-Ecosystem/mindspore
!22455 [bug][Ascend] Fix post training quantization code format
Merge pull request !22455 from chenzhuo/master
This commit is contained in:
commit
c0851e2e68
|
@ -182,7 +182,7 @@ void ModelProcess::DumpModelOutputResult(char *output_name) {
|
|||
ss << "result/" << output_name << "_output_" << i << ".bin";
|
||||
std::string outputFileName = ss.str();
|
||||
FILE *outputFile = fopen(outputFileName.c_str(), "wb");
|
||||
if (outputFile) {
|
||||
if (outputFile != nullptr) {
|
||||
aclDataBuffer* dataBuffer = aclmdlGetDatasetBuffer(output_, i);
|
||||
void* data = aclGetDataBufferAddr(dataBuffer);
|
||||
uint32_t len = aclGetDataBufferSizeV2(dataBuffer);
|
||||
|
|
|
@ -84,7 +84,7 @@ Result SampleProcess::InitResource() {
|
|||
|
||||
void SampleProcess::GetAllFiles(std::string path, std::vector<string> *files) {
|
||||
DIR *pDir = NULL;
|
||||
struct dirent* ptr;
|
||||
struct dirent* ptr = nullptr;
|
||||
if (!(pDir = opendir(path.c_str()))) {
|
||||
return;
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ void SampleProcess::GetAllFiles(std::string path, std::vector<string> *files) {
|
|||
|
||||
Result SampleProcess::Process(char *om_path, char *input_folder) {
|
||||
// model init
|
||||
double second_to_millisecond = 1000;
|
||||
double second_to_microsecond = 1000000;
|
||||
const double second_to_millisecond = 1000;
|
||||
const double second_to_microsecond = 1000000;
|
||||
|
||||
double whole_cost_time = 0.0;
|
||||
struct timeval start_global = {0};
|
||||
|
|
|
@ -182,7 +182,7 @@ void ModelProcess::DumpModelOutputResult(char *output_name) {
|
|||
ss << "result/" << output_name << "_output_" << i << ".bin";
|
||||
std::string outputFileName = ss.str();
|
||||
FILE *outputFile = fopen(outputFileName.c_str(), "wb");
|
||||
if (outputFile) {
|
||||
if (outputFile != nullptr) {
|
||||
aclDataBuffer* dataBuffer = aclmdlGetDatasetBuffer(output_, i);
|
||||
void* data = aclGetDataBufferAddr(dataBuffer);
|
||||
uint32_t len = aclGetDataBufferSizeV2(dataBuffer);
|
||||
|
|
|
@ -84,7 +84,7 @@ Result SampleProcess::InitResource() {
|
|||
|
||||
void SampleProcess::GetAllFiles(std::string path, std::vector<string> *files) {
|
||||
DIR *pDir = NULL;
|
||||
struct dirent* ptr;
|
||||
struct dirent* ptr = nullptr;
|
||||
if (!(pDir = opendir(path.c_str()))) {
|
||||
return;
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ void SampleProcess::GetAllFiles(std::string path, std::vector<string> *files) {
|
|||
|
||||
Result SampleProcess::Process(char *om_path, char *input_folder) {
|
||||
// model init
|
||||
double second_to_millisecond = 1000;
|
||||
double second_to_microsecond = 1000000;
|
||||
const double second_to_millisecond = 1000;
|
||||
const double second_to_microsecond = 1000000;
|
||||
|
||||
double whole_cost_time = 0.0;
|
||||
struct timeval start_global = {0};
|
||||
|
|
|
@ -182,7 +182,7 @@ void ModelProcess::DumpModelOutputResult(char *output_name) {
|
|||
ss << "result/" << output_name << "_output_" << i << ".bin";
|
||||
std::string outputFileName = ss.str();
|
||||
FILE *outputFile = fopen(outputFileName.c_str(), "wb");
|
||||
if (outputFile) {
|
||||
if (outputFile != nullptr) {
|
||||
aclDataBuffer* dataBuffer = aclmdlGetDatasetBuffer(output_, i);
|
||||
void* data = aclGetDataBufferAddr(dataBuffer);
|
||||
uint32_t len = aclGetDataBufferSizeV2(dataBuffer);
|
||||
|
|
|
@ -84,7 +84,7 @@ Result SampleProcess::InitResource() {
|
|||
|
||||
void SampleProcess::GetAllFiles(std::string path, std::vector<string> *files) {
|
||||
DIR *pDir = NULL;
|
||||
struct dirent* ptr;
|
||||
struct dirent* ptr = nullptr;
|
||||
if (!(pDir = opendir(path.c_str()))) {
|
||||
return;
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ void SampleProcess::GetAllFiles(std::string path, std::vector<string> *files) {
|
|||
|
||||
Result SampleProcess::Process(char *om_path, char *input_folder, char *shape_folder) {
|
||||
// model init
|
||||
double second_to_millisecond = 1000;
|
||||
double second_to_microsecond = 1000000;
|
||||
const double second_to_millisecond = 1000;
|
||||
const double second_to_microsecond = 1000000;
|
||||
|
||||
double whole_cost_time = 0.0;
|
||||
struct timeval start_global = {0};
|
||||
|
|
|
@ -182,7 +182,7 @@ void ModelProcess::DumpModelOutputResult(char *output_name) {
|
|||
ss << "result/" << output_name << "_output_" << i << ".bin";
|
||||
std::string outputFileName = ss.str();
|
||||
FILE *outputFile = fopen(outputFileName.c_str(), "wb");
|
||||
if (outputFile) {
|
||||
if (outputFile != nullptr) {
|
||||
aclDataBuffer* dataBuffer = aclmdlGetDatasetBuffer(output_, i);
|
||||
void* data = aclGetDataBufferAddr(dataBuffer);
|
||||
uint32_t len = aclGetDataBufferSizeV2(dataBuffer);
|
||||
|
|
|
@ -84,7 +84,7 @@ Result SampleProcess::InitResource() {
|
|||
|
||||
void SampleProcess::GetAllFiles(std::string path, std::vector<string> *files) {
|
||||
DIR *pDir = NULL;
|
||||
struct dirent* ptr;
|
||||
struct dirent* ptr = nullptr;
|
||||
if (!(pDir = opendir(path.c_str()))) {
|
||||
return;
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ void SampleProcess::GetAllFiles(std::string path, std::vector<string> *files) {
|
|||
|
||||
Result SampleProcess::Process(char *om_path, char *input_folder) {
|
||||
// model init
|
||||
double second_to_millisecond = 1000;
|
||||
double second_to_microsecond = 1000000;
|
||||
const double second_to_millisecond = 1000;
|
||||
const double second_to_microsecond = 1000000;
|
||||
|
||||
double whole_cost_time = 0.0;
|
||||
struct timeval start_global = {0};
|
||||
|
|
|
@ -182,7 +182,7 @@ void ModelProcess::DumpModelOutputResult(char *output_name) {
|
|||
ss << "result/" << output_name << "_output_" << i << ".bin";
|
||||
std::string outputFileName = ss.str();
|
||||
FILE *outputFile = fopen(outputFileName.c_str(), "wb");
|
||||
if (outputFile) {
|
||||
if (outputFile != nullptr) {
|
||||
aclDataBuffer* dataBuffer = aclmdlGetDatasetBuffer(output_, i);
|
||||
void* data = aclGetDataBufferAddr(dataBuffer);
|
||||
uint32_t len = aclGetDataBufferSizeV2(dataBuffer);
|
||||
|
|
|
@ -84,7 +84,7 @@ Result SampleProcess::InitResource() {
|
|||
|
||||
void SampleProcess::GetAllFiles(std::string path, std::vector<string> *files) {
|
||||
DIR *pDir = NULL;
|
||||
struct dirent* ptr;
|
||||
struct dirent* ptr = nullptr;
|
||||
if (!(pDir = opendir(path.c_str()))) {
|
||||
return;
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ void SampleProcess::GetAllFiles(std::string path, std::vector<string> *files) {
|
|||
|
||||
Result SampleProcess::Process(char *om_path, char *input_folder) {
|
||||
// model init
|
||||
double second_to_millisecond = 1000;
|
||||
double second_to_microsecond = 1000000;
|
||||
const double second_to_millisecond = 1000;
|
||||
const double second_to_microsecond = 1000000;
|
||||
|
||||
double whole_cost_time = 0.0;
|
||||
struct timeval start_global = {0};
|
||||
|
|
|
@ -182,7 +182,7 @@ void ModelProcess::DumpModelOutputResult(char *output_name) {
|
|||
ss << "result/" << output_name << "_output_" << i << ".bin";
|
||||
std::string outputFileName = ss.str();
|
||||
FILE *outputFile = fopen(outputFileName.c_str(), "wb");
|
||||
if (outputFile) {
|
||||
if (outputFile != nullptr) {
|
||||
aclDataBuffer* dataBuffer = aclmdlGetDatasetBuffer(output_, i);
|
||||
void* data = aclGetDataBufferAddr(dataBuffer);
|
||||
uint32_t len = aclGetDataBufferSizeV2(dataBuffer);
|
||||
|
|
|
@ -84,7 +84,7 @@ Result SampleProcess::InitResource() {
|
|||
|
||||
void SampleProcess::GetAllFiles(std::string path, std::vector<string> *files) {
|
||||
DIR *pDir = NULL;
|
||||
struct dirent* ptr;
|
||||
struct dirent* ptr = nullptr;
|
||||
if (!(pDir = opendir(path.c_str()))) {
|
||||
return;
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ void SampleProcess::GetAllFiles(std::string path, std::vector<string> *files) {
|
|||
|
||||
Result SampleProcess::Process(char *om_path, char *input_folder) {
|
||||
// model init
|
||||
double second_to_millisecond = 1000;
|
||||
double second_to_microsecond = 1000000;
|
||||
const double second_to_millisecond = 1000;
|
||||
const double second_to_microsecond = 1000000;
|
||||
|
||||
double whole_cost_time = 0.0;
|
||||
struct timeval start_global = {0};
|
||||
|
|
|
@ -66,12 +66,13 @@ if __name__ == "__main__":
|
|||
load_param_into_net(net, param_dict)
|
||||
net.set_train(False)
|
||||
|
||||
config.batch_size = 1
|
||||
config.batch_size = 16
|
||||
data_path = os.path.join(config.data_dir, "val2014")
|
||||
datasets, data_size = create_yolo_dataset(data_path, config.annFile, is_training=False,
|
||||
batch_size=config.batch_size, max_epoch=1, device_num=1, rank=0,
|
||||
shuffle=False, config=config)
|
||||
ds = datasets.take(1)
|
||||
shape = [config.batch_size, 3] + config.test_img_shape
|
||||
export_batch_size = 1
|
||||
shape = [export_batch_size, 3] + config.test_img_shape
|
||||
inputs = Tensor(np.zeros(shape), ms.float32)
|
||||
quant_yolov3(net, ds, inputs)
|
||||
|
|
|
@ -182,7 +182,7 @@ void ModelProcess::DumpModelOutputResult(char *output_name) {
|
|||
ss << "result/" << output_name << "_output_" << i << ".bin";
|
||||
std::string outputFileName = ss.str();
|
||||
FILE *outputFile = fopen(outputFileName.c_str(), "wb");
|
||||
if (outputFile) {
|
||||
if (outputFile != nullptr) {
|
||||
aclDataBuffer* dataBuffer = aclmdlGetDatasetBuffer(output_, i);
|
||||
void* data = aclGetDataBufferAddr(dataBuffer);
|
||||
uint32_t len = aclGetDataBufferSizeV2(dataBuffer);
|
||||
|
|
|
@ -84,7 +84,7 @@ Result SampleProcess::InitResource() {
|
|||
|
||||
void SampleProcess::GetAllFiles(std::string path, std::vector<string> *files) {
|
||||
DIR *pDir = NULL;
|
||||
struct dirent* ptr;
|
||||
struct dirent* ptr = nullptr;
|
||||
if (!(pDir = opendir(path.c_str()))) {
|
||||
return;
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ void SampleProcess::GetAllFiles(std::string path, std::vector<string> *files) {
|
|||
|
||||
Result SampleProcess::Process(char *om_path, char *input_folder) {
|
||||
// model init
|
||||
double second_to_millisecond = 1000;
|
||||
double second_to_microsecond = 1000000;
|
||||
const double second_to_millisecond = 1000;
|
||||
const double second_to_microsecond = 1000000;
|
||||
|
||||
double whole_cost_time = 0.0;
|
||||
struct timeval start_global = {0};
|
||||
|
|
|
@ -182,7 +182,7 @@ void ModelProcess::DumpModelOutputResult(char *output_name) {
|
|||
ss << "result/" << output_name << "_output_" << i << ".bin";
|
||||
std::string outputFileName = ss.str();
|
||||
FILE *outputFile = fopen(outputFileName.c_str(), "wb");
|
||||
if (outputFile) {
|
||||
if (outputFile != nullptr) {
|
||||
aclDataBuffer* dataBuffer = aclmdlGetDatasetBuffer(output_, i);
|
||||
void* data = aclGetDataBufferAddr(dataBuffer);
|
||||
uint32_t len = aclGetDataBufferSizeV2(dataBuffer);
|
||||
|
|
|
@ -84,7 +84,7 @@ Result SampleProcess::InitResource() {
|
|||
|
||||
void SampleProcess::GetAllFiles(std::string path, std::vector<string> *files) {
|
||||
DIR *pDir = NULL;
|
||||
struct dirent* ptr;
|
||||
struct dirent* ptr = nullptr;
|
||||
if (!(pDir = opendir(path.c_str()))) {
|
||||
return;
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ void SampleProcess::GetAllFiles(std::string path, std::vector<string> *files) {
|
|||
|
||||
Result SampleProcess::Process(char *om_path, char *input_folder, char *shape_folder) {
|
||||
// model init
|
||||
double second_to_millisecond = 1000;
|
||||
double second_to_microsecond = 1000000;
|
||||
const double second_to_millisecond = 1000;
|
||||
const double second_to_microsecond = 1000000;
|
||||
|
||||
double whole_cost_time = 0.0;
|
||||
struct timeval start_global = {0};
|
||||
|
|
|
@ -182,7 +182,7 @@ void ModelProcess::DumpModelOutputResult(char *output_name) {
|
|||
ss << "result/" << output_name << "_output_" << i << ".bin";
|
||||
std::string outputFileName = ss.str();
|
||||
FILE *outputFile = fopen(outputFileName.c_str(), "wb");
|
||||
if (outputFile) {
|
||||
if (outputFile != nullptr) {
|
||||
aclDataBuffer* dataBuffer = aclmdlGetDatasetBuffer(output_, i);
|
||||
void* data = aclGetDataBufferAddr(dataBuffer);
|
||||
uint32_t len = aclGetDataBufferSizeV2(dataBuffer);
|
||||
|
|
|
@ -84,7 +84,7 @@ Result SampleProcess::InitResource() {
|
|||
|
||||
void SampleProcess::GetAllFiles(std::string path, std::vector<string> *files) {
|
||||
DIR *pDir = NULL;
|
||||
struct dirent* ptr;
|
||||
struct dirent* ptr = nullptr;
|
||||
if (!(pDir = opendir(path.c_str()))) {
|
||||
return;
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ void SampleProcess::GetAllFiles(std::string path, std::vector<string> *files) {
|
|||
|
||||
Result SampleProcess::Process(char *om_path, char *input_folder) {
|
||||
// model init
|
||||
double second_to_millisecond = 1000;
|
||||
double second_to_microsecond = 1000000;
|
||||
const double second_to_millisecond = 1000;
|
||||
const double second_to_microsecond = 1000000;
|
||||
|
||||
double whole_cost_time = 0.0;
|
||||
struct timeval start_global = {0};
|
||||
|
|
Loading…
Reference in New Issue