Browse Source

add file constant parser st

pull/584/head
黄桂军 3 years ago
parent
commit
d7166de5a4
3 changed files with 41 additions and 0 deletions
  1. BIN
      tests/st/testcase/origin_models/file_constant_input.bin
  2. +23
    -0
      tests/st/testcase/origin_models/onnx_file_const_type.onnx
  3. +18
    -0
      tests/st/testcase/test_onnx_parser.cc

BIN
tests/st/testcase/origin_models/file_constant_input.bin View File


+ 23
- 0
tests/st/testcase/origin_models/onnx_file_const_type.onnx View File

@@ -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

+ 18
- 0
tests/st/testcase/test_onnx_parser.cc View File

@@ -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<ge::AscendString, ge::AscendString> parser_params;
ge::Graph graph;
auto ret = ge::aclgrphParseONNX(model_file.c_str(), parser_params, graph);
EXPECT_EQ(ret, GRAPH_SUCCESS);
}

} // namespace ge

Loading…
Cancel
Save