mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-18 21:21:17 +00:00
Fixed bug in Flatten's axis (#18645)
Flatten's axis is in the range [-r, r] rather than [-r, r-1].
This commit is contained in:
parent
6781b6cf3d
commit
73a2eb82eb
1 changed files with 5 additions and 1 deletions
|
|
@ -36,7 +36,11 @@ Status FlattenOpBuilder::AddToModelBuilderImpl(ModelBuilder& model_builder,
|
|||
int64_t rank = input_shape.size();
|
||||
NodeAttrHelper helper(node);
|
||||
int64_t axis = helper.Get("axis", 1);
|
||||
axis = HandleNegativeAxis(axis, rank);
|
||||
ORT_ENFORCE(axis >= -rank && axis <= rank, "axis ", axis,
|
||||
" is not in valid range [-", rank, ",", rank, "]");
|
||||
if (axis < 0) {
|
||||
axis += rank;
|
||||
}
|
||||
|
||||
// Use WebNN's reshape to implement Flatten.
|
||||
int64_t num_pre_axis_elements = std::accumulate(
|
||||
|
|
|
|||
Loading…
Reference in a new issue