1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Merge pull request #29577 from abhishek-gola:scan_layer

Add Scan layer to the new engine #29577

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Abhishek Gola
2026-07-25 14:09:47 +05:30
committed by GitHub
parent 859d550029
commit fe482bd575
10 changed files with 325 additions and 57 deletions
@@ -858,6 +858,28 @@ CV__DNN_INLINE_NS_BEGIN
static Ptr<LoopLayer> create(const LayerParams& params);
};
class CV_EXPORTS ScanLayer : public Layer
{
public:
/** Number of trailing inputs that are scanned (the rest are loop-carried state). */
virtual int numScanInputs() const = 0;
/** Per-scan-input axis to iterate over (empty => 0 for all). */
virtual const std::vector<int>& scanInputAxes() const = 0;
/** Per-scan-output axis to stack along (empty => 0 for all). */
virtual const std::vector<int>& scanOutputAxes() const = 0;
/** Per-scan-input direction, 1 = reverse (empty => forward for all). */
virtual const std::vector<int>& scanInputDirections() const = 0;
/** Per-scan-output direction, 1 = reverse (empty => forward for all). */
virtual const std::vector<int>& scanOutputDirections() const = 0;
/** ONNX-declared rank of each body scan output (-1 if unknown). A declared rank of
* 0 (scalar) marks an output that OpenCV stores as [1] but must stack into a rank-1
* tensor, not [T, 1]. Empty => unknown for all. */
virtual const std::vector<int>& scanOutputRanks() const = 0;
/** Factory: creates a ScanLayer implementation. */
static Ptr<ScanLayer> create(const LayerParams& params);
};
class CV_EXPORTS ConcatLayer : public Layer
{
public: