Skip to content

Commit

Permalink
Add rank check in convert func of onnx converter
Browse files Browse the repository at this point in the history
  • Loading branch information
daquexian committed Jul 16, 2019
1 parent 4a4ded8 commit eff13f6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/onnx2daq/OnnxConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ OnnxConverter::FbStrVector(const std::vector<std::string> &std_str_vector) {
* nnapi: [1, height, width, depth_out]
*/
OnnxConverter::Tensor OnnxConverter::OnnxToNnapiAxes1230(const Tensor &src) {
if (src.shape.size() != 4) {
return src;
}
Tensor dest = src;
size_t elemsize = 0;
if (src.data_type == Tensor::DataType::UINT8) {
Expand Down Expand Up @@ -180,6 +183,9 @@ OnnxConverter::Tensor OnnxConverter::OnnxToNnapiAxes1230(const Tensor &src) {
}

OnnxConverter::Tensor OnnxConverter::OnnxToNnapiAxes0231(const Tensor &src) {
if (src.shape.size() != 4) {
return src;
}
Tensor dest = src;
size_t elemsize = 0;
if (src.data_type == Tensor::DataType::UINT8) {
Expand Down

0 comments on commit eff13f6

Please sign in to comment.