Browse Source

dts: onnex parser dim value set -1 modify when dynamic

pull/268/head
zhengyuanhua 4 years ago
parent
commit
4e965caf86
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      parser/onnx/onnx_parser.cc

+ 5
- 1
parser/onnx/onnx_parser.cc View File

@@ -148,6 +148,7 @@ const std::map<std::string, std::string> kOnnxOpMap = {
};
const char* const MATMULV2 = "MatMulV2";
const std::vector<std::string> kNoNeedUpdateFormat = {MATMULV2};
const int64_t kDimValue = 1;
}

Status OnnxModelParser::ParseInput(ge::onnx::GraphProto &onnx_graph,
@@ -182,7 +183,10 @@ Status OnnxModelParser::ParseInput(ge::onnx::GraphProto &onnx_graph,
const ge::onnx::TensorShapeProto tensor_shape = type_proto_tensor.shape();
for (int j = 0; j < tensor_shape.dim_size(); j++) {
const ge::onnx::TensorShapeProto_Dimension dimension = tensor_shape.dim(j);
int64_t dim_value = dimension.dim_value();
int64_t dim_value = -1;
if (dimension.value_case() == kDimValue) {
dim_value = dimension.dim_value();
}
tensor_tmp.add_dims(dim_value);
GELOGI("elem_type: %d, dim_value: %ld", elem_type, dim_value);
}


Loading…
Cancel
Save