@@ -707,58 +707,49 @@ INSTANTIATE_TEST_CASE_P(/**/, Layer_FullyConnected, Combine(
707707 dnnBackendsAndTargets()
708708));
709709
710- struct Layer_Softmax :public TestBaseWithParam <tuple<Backend, Target> >
711- {
712- void test_layer (const std::vector<int >& shape,int axis)
713- {
714- int backendId = get<0 >(GetParam ());
715- int targetId = get<1 >(GetParam ());
716-
717- Matdata (shape, CV_32FC1);
718- Scalar mean =0 .f ;
719- Scalar std =1 .f ;
720- randn (data, mean, std);
710+ typedef TestBaseWithParam<tuple<std::vector<int >,int , tuple<Backend, Target> > > Layer_Softmax;
721711
722- Net net;
723- LayerParams lp ;
724- lp. type = " Softmax " ;
725- lp. name = " testLayer " ;
726- lp. set ( " axis " , axis );
712+ PERF_TEST_P_ (Layer_Softmax, softmax_3d) {
713+ std::vector< int > shape = get< 0 >( GetParam ()) ;
714+ int axis = get< 1 >( GetParam ()) ;
715+ int backendId = get< 0 >(get< 2 >( GetParam ())) ;
716+ int targetId = get< 1 >(get< 2 >( GetParam ()) );
727717
728- net.addLayerToPrev (lp.name , lp.type , lp);
729- // warmup
730- {
731- net.setInput (data);
732- net.setPreferableBackend (backendId);
733- net.setPreferableTarget (targetId);
734- Mat out = net.forward ();
735- }
718+ Matdata (shape, CV_32FC1);
719+ Scalar mean =0 .f ;
720+ Scalar std =1 .f ;
721+ randn (data, mean, std);
736722
737- TEST_CYCLE ()
738- {
739- Mat res = net.forward ();
740- }
723+ Net net;
724+ LayerParams lp;
725+ lp.type =" Softmax" ;
726+ lp.name =" testLayer" ;
727+ lp.set (" axis" , axis);
741728
742- SANITY_CHECK_NOTHING ();
729+ net.addLayerToPrev (lp.name , lp.type , lp);
730+ // warmup
731+ {
732+ net.setInput (data);
733+ net.setPreferableBackend (backendId);
734+ net.setPreferableTarget (targetId);
735+ Mat out = net.forward ();
743736 }
744- };
745737
738+ TEST_CYCLE () {
739+ Mat res = net.forward ();
740+ }
746741
747- PERF_TEST_P_ (Layer_Softmax, Softmax_small)
748- {
749- test_layer ({16 ,50 ,50 },2 );
750- }
751-
752- PERF_TEST_P_ (Layer_Softmax, Softmax_middle)
753- {
754- test_layer ({16 ,197 ,197 },2 );
755- }
756-
757- PERF_TEST_P_ (Layer_Softmax, Softmax_large)
758- {
759- test_layer ({16 ,1080 ,1920 ,3 },2 );
742+ SANITY_CHECK_NOTHING ();
760743}
761744
762- INSTANTIATE_TEST_CASE_P (/* */ , Layer_Softmax, testing::Values(std::make_tuple(DNN_BACKEND_OPENCV, DNN_TARGET_CPU)));
745+ INSTANTIATE_TEST_CASE_P (/* */ , Layer_Softmax, Combine(
746+ Values (// input size
747+ std::vector<int >({16 ,50 ,50 }),
748+ std::vector<int>({16 ,197 ,197 }),
749+ std::vector<int>({16 ,1024 ,1024 })
750+ ),
751+ Values(0 ,1 ,2 ),// axis
752+ dnnBackendsAndTargets(false ,false ,false ,false ,false ,false ,false ,false )// only CPU
753+ ));
763754
764755}// namespace