diff --git a/tests/st/testcase/origin_models/file_constant_input.bin b/tests/st/testcase/origin_models/file_constant_input.bin new file mode 100644 index 0000000..7e619c9 Binary files /dev/null and b/tests/st/testcase/origin_models/file_constant_input.bin differ diff --git a/tests/st/testcase/origin_models/onnx_file_const_type.onnx b/tests/st/testcase/origin_models/onnx_file_const_type.onnx new file mode 100644 index 0000000..cce42bb --- /dev/null +++ b/tests/st/testcase/origin_models/onnx_file_const_type.onnx @@ -0,0 +1,23 @@ +:¢ + +x +yz"Add +test_graph*aBfile_constant_input.binj# +locationfile_constant_input.binj +offset0j +length24p*bBfile_constant_input.binj# +locationfile_constant_input.binj +offset24j +length24pZ +x +  + +Z +y +  + +b +z +  + +B \ No newline at end of file diff --git a/tests/st/testcase/test_onnx_parser.cc b/tests/st/testcase/test_onnx_parser.cc index 459abed..498706a 100644 --- a/tests/st/testcase/test_onnx_parser.cc +++ b/tests/st/testcase/test_onnx_parser.cc @@ -88,6 +88,7 @@ void STestOnnxParser::RegisterCustomOp() { REGISTER_CUSTOM_OP("Add") .FrameworkType(domi::ONNX) .OriginOpType("ai.onnx::11::Add") + .OriginOpType("ai.onnx::17::Add") .ParseParamsFn(ParseParams); REGISTER_CUSTOM_OP("Identity") @@ -174,4 +175,21 @@ TEST_F(STestOnnxParser, onnx_parser_const_data_type) { EXPECT_EQ(ret, GRAPH_SUCCESS); } +REG_OP(FileConstant) + .OUTPUT(y, TensorType(DT_INT32)) + .REQUIRED_ATTR(file_id, String) + .REQUIRED_ATTR(shape, ListInt) + .REQUIRED_ATTR(dtype, Type) + .OP_END_FACTORY_REG(FileConstant) + +TEST_F(STestOnnxParser, onnx_parser_file_const_data_type) { + std::string case_dir = __FILE__; + case_dir = case_dir.substr(0, case_dir.find_last_of("/")); + std::string model_file = case_dir + "/origin_models/onnx_file_const_type.onnx"; + std::map parser_params; + ge::Graph graph; + auto ret = ge::aclgrphParseONNX(model_file.c_str(), parser_params, graph); + EXPECT_EQ(ret, GRAPH_SUCCESS); +} + } // namespace ge