Files
opencv-MIRROR/modules
Ishita Singh ac7d331a79 dnn: keep Flatten axis attributes unchanged in finalize
FlattenLayerImpl::finalize previously overwrote _startAxis and _endAxis
with normalize_axis(..., numAxes) for the rank of the first input.
Since end_axis defaults to -1 (and axis can also be negative), this
replaced relative negative indices with positive indices bound to the
first input rank.

Reusing the same Flatten layer on an input of a different rank then:
- flattened the wrong range of dimensions when rank increased (e.g.
  [2, 3, 4, 5] flattened to [2, 12, 5] instead of [2, 60] for default
  axis=1, end_axis=-1), or
- triggered an assertion failure in normalize_axis when rank decreased
  (e.g. stale end_axis=3 on a 3D input).

getMemoryShapes, initCann, and initNgraph already normalize _startAxis
and _endAxis locally, and forward/forward_ocl/initCUDA use the output
shapes directly. Keep _startAxis and _endAxis unchanged in finalize
while still validating the normalized axis range.
2026-12-01 13:49:15 +05:30
..