Skip to content

Commit

Permalink
pnnx skip dynamic size evaluation (#4291)
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui authored Oct 20, 2022
1 parent 8eab5ea commit 8edc03c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tools/pnnx/src/pass_level5/eval_expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,17 @@ static std::string eval_expression(const Operator* op)
{
int bi = std::stoi(b);
int r = op->inputs[input_index]->shape[bi];
exprstack.push(std::to_string(r));
if (r == -1)
{
// do not evaluate dynamic size info as -1
// just keep the size expression
std::string r = std::string("size(") + a + "," + b + ")";
exprstack.push(r);
}
else
{
exprstack.push(std::to_string(r));
}
}
}
else
Expand Down

0 comments on commit 8edc03c

Please sign in to comment.