Skip to content

Commit

Permalink
fix build, prepend batch for broadcast reshape
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui committed Jul 6, 2023
1 parent 47e0daf commit 7ad11a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 0 additions & 4 deletions tools/pnnx/src/pass_level5/eval_expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,10 @@ static std::string eval_expression(const Operator* op)
if (t == "round")
{
// round to nearest even
#if FLT_ROUNDS != FE_TONEAREST
int old_rm = fegetround();
fesetround(FE_TONEAREST);
#endif
float r = nearbyintf(af);
#if FLT_ROUNDS != FE_TONEAREST
fesetround(old_rm);
#endif
exprstack.push(std::to_string(r));
}
if (t == "rsqrt")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ void insert_reshape_numpy_binaryop_broadcast(Graph& graph)
reshape0_shape.insert(reshape0_shape.begin(), 1);
}

if (batch_index0 != -233)
{
reshape0_shape.insert(reshape0_shape.begin() + batch_index0, 1);
}

reshape0->params["shape"] = reshape0_shape;

break;
Expand Down

0 comments on commit 7ad11a8

Please sign in to comment.