已合并
geir用例修改 #3795
Ding_Jing创建于 4月14日
geir用例修改 #3795
已合并
Ding_Jing创建于 4月14日
8 个文件变更+19-34
@@ -26,7 +26,6 @@
26#include "array_ops.h"26#include "array_ops.h"
27#include "ge_ir_build.h"27#include "ge_ir_build.h"
28 28 
29-#include "experiment_ops.h"
30#include "nn_other.h"29#include "nn_other.h"
31#include "../op_graph/assert_proto.h"30#include "../op_graph/assert_proto.h"
32 31 
@@ -26,7 +26,6 @@
26#include "array_ops.h"26#include "array_ops.h"
27#include "ge_ir_build.h"27#include "ge_ir_build.h"
28 28 
29-#include "experiment_ops.h"
30#include "nn_other.h"29#include "nn_other.h"
31 30 
32#define FAILED -131#define FAILED -1
@@ -282,15 +281,15 @@ int main(int argc, char *argv[])
282 }281 }
283 }282 }
284 283 
285- ge::AscendString error_msg = ge::GEGetErrorMsgV2();
286- std::string error_str(error_msg.GetString());
287- std::cout << "Error message: " << error_str << std::endl;
288- ge::AscendString warning_msg = ge::GEGetWarningMsgV2();
289- std::string warning_str(warning_msg.GetString());
290- std::cout << "Warning message: " << warning_str << std::endl;
291 printf("%s - INFO - [XIR]: Start to finalize ir graph session\n", GetTime().c_str());284 printf("%s - INFO - [XIR]: Start to finalize ir graph session\n", GetTime().c_str());
292 ret = ge::GEFinalize();285 ret = ge::GEFinalize();
293 if (ret != SUCCESS) {286 if (ret != SUCCESS) {
287+ ge::AscendString error_msg = ge::GEGetErrorMsgV2();
288+ std::string error_str(error_msg.GetString());
289+ std::cout << "Error message: " << error_str << std::endl;
290+ ge::AscendString warning_msg = ge::GEGetWarningMsgV2();
291+ std::string warning_str(warning_msg.GetString());
292+ std::cout << "Warning message: " << warning_str << std::endl;
294 printf("%s - INFO - [XIR]: Finalize ir graph session failed\n", GetTime().c_str());293 printf("%s - INFO - [XIR]: Finalize ir graph session failed\n", GetTime().c_str());
295 return FAILED;294 return FAILED;
296 }295 }
@@ -46,7 +46,6 @@
46#include "array_ops.h"46#include "array_ops.h"
47#include "ge_ir_build.h"47#include "ge_ir_build.h"
48 48 
49-#include "experiment_ops.h"
50#include "nn_other.h"49#include "nn_other.h"
51#include "../op_graph/add_example_aicpu_proto.h"50#include "../op_graph/add_example_aicpu_proto.h"
52 51 
@@ -32,7 +32,6 @@
32#include "tensor.h"32#include "tensor.h"
33#include "types.h"33#include "types.h"
34 34 
35-#include "experiment_ops.h"
36#include "nn_other.h"35#include "nn_other.h"
37#include "../op_graph/gather_v2_proto.h"36#include "../op_graph/gather_v2_proto.h"
38 37 
@@ -25,7 +25,6 @@
25#include "ge_api.h"25#include "ge_api.h"
26#include "ge_ir_build.h"26#include "ge_ir_build.h"
27 27 
28-#include "experiment_ops.h"
29#include "nn_other.h"28#include "nn_other.h"
30#include "../op_graph/reverse_sequence_proto.h"29#include "../op_graph/reverse_sequence_proto.h"
31 30 
@@ -212,6 +211,12 @@ bool AddGraphToSession(ge::Session* session, Graph& graph, uint32_t graph_id) {
212 211 
213 Status ret = session->AddGraph(graph_id, graph, graph_options);212 Status ret = session->AddGraph(graph_id, graph, graph_options);
214 if (ret != SUCCESS) {213 if (ret != SUCCESS) {
214+ ge::AscendString error_msg = ge::GEGetErrorMsgV2();
215+ std::string error_str(error_msg.GetString());
216+ std::cout << "Error message: " << error_str << std::endl;
217+ ge::AscendString warning_msg = ge::GEGetWarningMsgV2();
218+ std::string warning_str(warning_msg.GetString());
219+ std::cout << "Warning message: " << warning_str << std::endl;
215 LOG_PRINT("%s - INFO - [XIR]: Add graph failed\n", GetTime().c_str());220 LOG_PRINT("%s - INFO - [XIR]: Add graph failed\n", GetTime().c_str());
216 delete session;221 delete session;
217 ge::GEFinalize();222 ge::GEFinalize();
@@ -256,12 +261,6 @@ void ProcessOutputData(std::vector<ge::Tensor>& output) {
256}261}
257 262 
258int FinalizeRes() {263int FinalizeRes() {
259- ge::AscendString error_msg = ge::GEGetErrorMsgV2();
260- std::string error_str(error_msg.GetString());
261- std::cout << "Error message: " << error_str << std::endl;
262- ge::AscendString warning_msg = ge::GEGetWarningMsgV2();
263- std::string warning_str(warning_msg.GetString());
264- std::cout << "Warning message: " << warning_str << std::endl;
265 Status ret = ge::GEFinalize();264 Status ret = ge::GEFinalize();
266 if (ret != SUCCESS) {265 if (ret != SUCCESS) {
267 LOG_PRINT("%s - INFO - [XIR]: Finalize ir graph session failed\n", GetTime().c_str());266 LOG_PRINT("%s - INFO - [XIR]: Finalize ir graph session failed\n", GetTime().c_str());
@@ -31,7 +31,6 @@
31#include "tensor.h"31#include "tensor.h"
32#include "types.h"32#include "types.h"
33 33 
34-#include "experiment_ops.h"
35#include "nn_other.h"34#include "nn_other.h"
36#include "../op_graph/scatter_elements_proto.h"35#include "../op_graph/scatter_elements_proto.h"
37 36 
@@ -36,7 +36,6 @@
36#include "tensor.h"36#include "tensor.h"
37#include "types.h"37#include "types.h"
38 38 
39-#include "experiment_ops.h"
40#include "nn_other.h"39#include "nn_other.h"
41#include "../op_graph/tensor_scatter_update_proto.h"40#include "../op_graph/tensor_scatter_update_proto.h"
42 41 
@@ -164,7 +163,7 @@ int32_t GenTensorData(const vector<int64_t> &shapes, Tensor &input_tensor, Tenso
164 uint32_t data_len = size * sizeof(T);163 uint32_t data_len = size * sizeof(T);
165 T *p_data = new (std::nothrow) T[size];164 T *p_data = new (std::nothrow) T[size];
166 if (p_data == nullptr) {165 if (p_data == nullptr) {
167- delete[] data;166+ delete[] p_data;
168 return FAILED;167 return FAILED;
169 }168 }
170 for (size_t i = 0; i < size; ++i) {169 for (size_t i = 0; i < size; ++i) {
@@ -311,13 +310,6 @@ int main(int argc, char *argv[])
311 310 
312 SaveInputOutput(input, output);311 SaveInputOutput(input, output);
313 312 
314- ge::AscendString error_msg = ge::GEGetErrorMsgV2();
315- std::string error_str(error_msg.GetString());
316- std::cout << "Error message: " << error_str << std::endl;
317- ge::AscendString warning_msg = ge::GEGetWarningMsgV2();
318- std::string warning_str(warning_msg.GetString());
319- std::cout << "Warning message: " << warning_str << std::endl;
320- 
321 delete session;313 delete session;
322 314 
323 printf("%s - INFO - [XIR]: Start to finalize ir graph session\n", GetTime().c_str());315 printf("%s - INFO - [XIR]: Start to finalize ir graph session\n", GetTime().c_str());
@@ -25,7 +25,6 @@
25#include "ge_api.h"25#include "ge_api.h"
26#include "ge_ir_build.h"26#include "ge_ir_build.h"
27 27 
28-#include "experiment_ops.h"
29#include "nn_other.h"28#include "nn_other.h"
30#include "../op_graph/where_proto.h"29#include "../op_graph/where_proto.h"
31 30 
@@ -246,6 +245,12 @@ bool AddGraphToSession(ge::Session* session, Graph& graph, uint32_t graph_id) {
246 };245 };
247 Status ret = session->AddGraph(graph_id, graph, graph_options);246 Status ret = session->AddGraph(graph_id, graph, graph_options);
248 if (ret != SUCCESS) {247 if (ret != SUCCESS) {
248+ ge::AscendString error_msg = ge::GEGetErrorMsgV2();
249+ std::string error_str(error_msg.GetString());
250+ std::cout << "Error message: " << error_str << std::endl;
251+ ge::AscendString warning_msg = ge::GEGetWarningMsgV2();
252+ std::string warning_str(warning_msg.GetString());
253+ std::cout << "Warning message: " << warning_str << std::endl;
249 printf("%s - INFO - [XIR]: Add graph failed\n", GetTime().c_str());254 printf("%s - INFO - [XIR]: Add graph failed\n", GetTime().c_str());
250 delete session;255 delete session;
251 ge::GEFinalize();256 ge::GEFinalize();
@@ -306,12 +311,6 @@ void ProcessOutputData(std::vector<ge::Tensor>& output) {
306}311}
307 312 
308int FinalizeRes() {313int FinalizeRes() {
309- ge::AscendString error_msg = ge::GEGetErrorMsgV2();
310- std::string error_str(error_msg.GetString());
311- std::cout << "Error message: " << error_str << std::endl;
312- ge::AscendString warning_msg = ge::GEGetWarningMsgV2();
313- std::string warning_str(warning_msg.GetString());
314- std::cout << "Warning message: " << warning_str << std::endl;
315 printf("%s - INFO - [XIR]: Precision is ok\n", GetTime().c_str());314 printf("%s - INFO - [XIR]: Precision is ok\n", GetTime().c_str());
316 printf("%s - INFO - [XIR]: Start to finalize ir graph session\n", GetTime().c_str());315 printf("%s - INFO - [XIR]: Start to finalize ir graph session\n", GetTime().c_str());
317 Status ret = ge::GEFinalize();316 Status ret = ge::GEFinalize();