Skip to content

Commit

Permalink
Support reshape before gemm
Browse files Browse the repository at this point in the history
  • Loading branch information
daquexian committed Nov 10, 2019
1 parent 2d26ee0 commit c7c41be
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tools/onnx2bnn/OnnxConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,14 @@ std::vector<std::string> OnnxConverter::Convert(
vector<string> binary_conv_outputs;
bool has_reshape = false;
for (const auto &node : model_proto_.graph().node()) {
if (has_reshape) {
throw std::invalid_argument(
"Reshape can only be the last layer for now");
}
NodeAttrHelper helper(node);
const auto &op = node.op_type();
if (has_reshape && op != "Gemm") {
throw std::invalid_argument(
"Reshape can only be the last layer or precede a gemm layer "
"for now");
}
has_reshape = false;
VLOG(5) << "Node " << node.name();
if (op == "Conv") {
VLOG(5) << "Start converting Conv";
Expand Down

0 comments on commit c7c41be

Please sign in to comment.