Skip to content

Commit

Permalink
graph: backend: dnnl: fix out-of-bounds access in transform
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiexin-Zheng authored and TaoLv committed Jan 16, 2025
1 parent 162281c commit db7bb91
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/graph/backend/dnnl/passes/transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2287,10 +2287,10 @@ status_t binary_canonicalization(std::shared_ptr<subgraph_t> &sg) {
int32_t target_ndims = std::max(src0_ndims, src1_ndims);
std::vector<int32_t> in_ndims {src0_ndims, src1_ndims};
for (size_t i = 0; i < cur_op->num_inputs(); ++i) {
if (in_ndims[i] == target_ndims) { continue; }
// For binary select op, broadcast for the third input is
// unsupported.
if (i == 2) { continue; }
if (in_ndims[i] == target_ndims) { continue; }

std::vector<int64_t> axes(target_ndims - in_ndims[i]);
std::iota(axes.begin(), axes.end(), 0);
Expand Down

0 comments on commit db7bb91

Please sign in to comment.