@@ -377,6 +377,7 @@ size_t RoiPoolingKey::hash() const {
377377 seed = hash_combine (seed, refParams.mb );
378378 seed = hash_combine (seed, refParams.c );
379379 seed = hash_combine (seed, refParams.nb_c );
380+ seed = hash_combine (seed, refParams.b_num );
380381 seed = hash_combine (seed, refParams.c_block );
381382 seed = hash_combine (seed, refParams.nb_c_blocking );
382383 seed = hash_combine (seed, refParams.ih );
@@ -546,9 +547,12 @@ void ROIPooling::prepareParams() {
546547 const auto & inDims = getParentEdgeAt (0 )->getMemory ().getStaticDims ();
547548 const auto & outDims = getChildEdgeAt (0 )->getMemory ().getStaticDims ();
548549
550+ const auto & featureShape = getParentEdgeAt (0 )->getMemory ().getStaticDims ();
551+
549552 refParams.mb = outDims[0 ];
550553 refParams.c = rnd_up (inDims[1 ], refParams.c_block );
551554 refParams.nb_c = refParams.c / refParams.c_block ;
555+ refParams.b_num = featureShape[0 ];
552556 refParams.ih = inDims[2 ];
553557 refParams.iw = inDims[3 ];
554558 refParams.oh = outDims[2 ];
@@ -619,6 +623,9 @@ class ROIPooling::ROIPoolingJitExecutor : public ROIPooling::ROIPoolingExecutor
619623 if (roi_batch_ind == -1 ) {
620624 break ;
621625 }
626+ OPENVINO_ASSERT (0 <= roi_batch_ind && roi_batch_ind <= jpp.b_num ,
627+ " takes incorrect roi_ind, max roi_ind = " ,
628+ jpp.b_num );
622629 }
623630
624631 cpuParallel->parallel_for4d (MB, cb_work, jpp.oh , jpp.ow , [&](int n, int cbb, int oh, int ow) {
@@ -636,6 +643,9 @@ class ROIPooling::ROIPoolingJitExecutor : public ROIPooling::ROIPoolingExecutor
636643 const auto * src_roi_ptr = &src_roi[roi_off];
637644
638645 auto roi_batch_ind = static_cast <int >(src_roi_ptr[0 ]);
646+ OPENVINO_ASSERT (0 <= roi_batch_ind && roi_batch_ind <= jpp.b_num ,
647+ " takes incorrect roi_ind, max roi_ind = " ,
648+ jpp.b_num );
639649
640650 if (jpp.alg == Algorithm::ROIPoolingMax) {
641651 auto roi_start_w = static_cast <int >(round (src_roi_ptr[1 ] * jpp.spatial_scale ));
@@ -758,6 +768,9 @@ class ROIPooling::ROIPoolingRefExecutor : public ROIPooling::ROIPoolingExecutor
758768 if (roi_batch_ind == -1 ) {
759769 break ;
760770 }
771+ OPENVINO_ASSERT (0 <= roi_batch_ind && roi_batch_ind <= jpp.b_num ,
772+ " takes incorrect roi_ind, max roi_ind = " ,
773+ jpp.b_num );
761774 }
762775
763776 cpuParallel->parallel_for4d (MB, cb_work, jpp.oh , jpp.ow , [&](int n, int cbb, int oh, int ow) {
@@ -780,6 +793,9 @@ class ROIPooling::ROIPoolingRefExecutor : public ROIPooling::ROIPoolingExecutor
780793 const auto * src_roi_ptr = &src_roi[roi_off];
781794
782795 auto roi_batch_ind = static_cast <int >(src_roi_ptr[0 ]);
796+ OPENVINO_ASSERT (0 <= roi_batch_ind && roi_batch_ind <= jpp.b_num ,
797+ " takes incorrect roi_ind, max roi_ind = " ,
798+ jpp.b_num );
783799
784800 if (jpp.alg == Algorithm::ROIPoolingMax) {
785801 auto roi_start_w = static_cast <int >(round (src_roi_ptr[1 ] * jpp.spatial_scale ));
0 commit comments