::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 37, 43, 43)
, MAKE_STRUCT(tensor_test_params, 1, 37, 19, 19))
- , ::testing::Values<kernel>(
- MAKE_STRUCT(param_size, 3, 3)
- )
+ , ::testing::Values<kernel>(MAKE_STRUCT(param_size, 3, 3))
, ::testing::Values<stride>(MAKE_STRUCT(param_size, 1, 1)
, MAKE_STRUCT(param_size, 2, 2)
, MAKE_STRUCT(param_size, 3, 3)
)
);
-INSTANTIATE_TEST_CASE_P(accuracy_crossroad_spatialConv, myriadLayerConvolutionTensorFlow_smoke,
+INSTANTIATE_TEST_CASE_P(accuracy_crossroad_spatialConv, myriadLayerConvolutionTensorFlow,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 3, 1024, 1024))
, ::testing::Values<DimsOutput>(MAKE_STRUCT(tensor_test_params, 1, 3, 512, 512))
)
);
-INSTANTIATE_TEST_CASE_P(accuracy_inception_v2, myriadLayerConvolutionTensorFlow_smoke,
+INSTANTIATE_TEST_CASE_P(accuracy_inception_v2, myriadLayerConvolutionTensorFlow,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 16, 28, 28))
, ::testing::Values<DimsOutput>(MAKE_STRUCT(tensor_test_params, 1, 64, 14, 14))
)
);
-INSTANTIATE_TEST_CASE_P(accuracy_inception_v1, myriadLayerConvolutionTensorFlow_smoke,
+INSTANTIATE_TEST_CASE_P(accuracy_inception_v1, myriadLayerConvolutionTensorFlow,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 3, 224, 224),
MAKE_STRUCT(tensor_test_params, 1, 32, 224, 224)
)
);
-INSTANTIATE_TEST_CASE_P(test_3x3_SSD_dilation, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(test_3x3_SSD_dilation, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 512, 19, 19))
, ::testing::Values<kernel>(MAKE_STRUCT(param_size, 3, 3))
)
);
-INSTANTIATE_TEST_CASE_P(test_3x3_icvnet_dilation, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(test_3x3_icvnet_dilation, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 24, 20, 20))
, ::testing::Values<kernel>(MAKE_STRUCT(param_size, 3, 3))
)
);
-INSTANTIATE_TEST_CASE_P(test_5x5_with_dilation, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(test_5x5_with_dilation, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 32, 64, 77))
, ::testing::Values<kernel>(MAKE_STRUCT(param_size, 5, 5))
)
);
-INSTANTIATE_TEST_CASE_P(test_7x7_with_dilation, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(test_7x7_with_dilation, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 32, 64, 77))
, ::testing::Values<kernel>(MAKE_STRUCT(param_size, 7, 7))
);
-INSTANTIATE_TEST_CASE_P(test_conv1x1, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(test_conv1x1, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 10, 13, 13))
, ::testing::Values<kernel>(MAKE_STRUCT(param_size, 1, 1))
)
);
-INSTANTIATE_TEST_CASE_P(test_yolo_tiny_2_512x13x13_use_3x3_convolution, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(test_yolo_tiny_2_512x13x13_use_3x3_convolution, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 512, 13, 13))
, ::testing::Values<kernel>(MAKE_STRUCT(param_size, 3, 3))
)
);
-INSTANTIATE_TEST_CASE_P(test_yolo_tiny_2_512x13x13_use_1x1_convolution, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(test_yolo_tiny_2_512x13x13_use_1x1_convolution, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 4608, 13, 13))
, ::testing::Values<kernel>(MAKE_STRUCT(param_size, 1, 1))
)
);
-INSTANTIATE_TEST_CASE_P(accuracy_group, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(accuracy_group, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 32, 64, 77)
, MAKE_STRUCT(tensor_test_params, 1, 32, 112, 96))
)
);
-INSTANTIATE_TEST_CASE_P(accuracy_group_large_input, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(accuracy_group_large_input, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 32, 192, 336))
, ::testing::Values<kernel>(MAKE_STRUCT(param_size, 3, 3))
, ::testing::Values<out_channels>(32)
, ::testing::Values<group>(2, 4, 16)
, ::testing::Values<dilation_factor>(MAKE_STRUCT(param_size, 1, 2), MAKE_STRUCT(param_size, 2, 3), MAKE_STRUCT(param_size, 3, 4)),
- ::testing::Values<layoutPreference>(vpu::LayoutPreference::ChannelMinor,
- vpu::LayoutPreference::ChannelMajor)
+ ::testing::Values<layoutPreference>(vpu::LayoutPreference::ChannelMajor)
+ )
+);
+
+INSTANTIATE_TEST_CASE_P(accuracy_any_group, myriadLayerConvolution,
+ ::testing::Combine(
+ ::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 32, 64, 77))
+ , ::testing::Values<kernel>(MAKE_STRUCT(param_size, 3, 3))
+ , ::testing::Values<stride>(MAKE_STRUCT(param_size, 1, 1)
+ , MAKE_STRUCT(param_size, 2, 2))
+ , ::testing::Values<pad>(MAKE_STRUCT(param_size, 1, 1)
+ , MAKE_STRUCT(param_size, 0, 0)
+ , MAKE_STRUCT(param_size, 2, 2))
+ , ::testing::Values<out_channels>(32)
+ , ::testing::Values<group>(2, 4, 16)
+ , ::testing::Values<dilation_factor>(MAKE_STRUCT(param_size, 1, 2), MAKE_STRUCT(param_size, 2, 3), MAKE_STRUCT(param_size, 3, 4)),
+ ::testing::Values<layoutPreference>(vpu::LayoutPreference::ChannelMinor)
)
);
-INSTANTIATE_TEST_CASE_P(set_optimization_for_3x3_with_group, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(set_optimization_for_3x3_with_group, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 24, 80, 80)
, MAKE_STRUCT(tensor_test_params, 1, 36, 80, 80))
)
);
-INSTANTIATE_TEST_CASE_P(set_optimization_for_3x3s1, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(set_optimization_for_3x3s1, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 24, 80, 80))
, ::testing::Values<kernel>(MAKE_STRUCT(param_size, 3, 3))
)
);
-INSTANTIATE_TEST_CASE_P(accuracy_1x1, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(accuracy_1x1, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 16, 64, 64)
, MAKE_STRUCT(tensor_test_params, 1, 32, 1, 1))
)
);
-INSTANTIATE_TEST_CASE_P(accuracy_3x3, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(accuracy_3x3, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 8, 16, 16)
, MAKE_STRUCT(tensor_test_params, 1, 8, 59, 73))
)
);
-INSTANTIATE_TEST_CASE_P(accuracy_1x3, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(accuracy_1x3, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 8, 59, 73))
, ::testing::Values<kernel>(MAKE_STRUCT(param_size, 1, 3), MAKE_STRUCT(param_size, 3, 1))
, ::testing::Values<out_channels>(16, 32)
, ::testing::Values<group>(1)
, ::testing::Values<dilation_factor>(MAKE_STRUCT(param_size, 1, 2)),
- ::testing::Values<layoutPreference>(vpu::LayoutPreference::ChannelMinor,
- vpu::LayoutPreference::ChannelMajor)
+ ::testing::Values<layoutPreference>(vpu::LayoutPreference::ChannelMajor)
+ )
+);
+
+INSTANTIATE_TEST_CASE_P(accuracy_5x5, myriadLayerConvolution,
+ ::testing::Combine(
+ ::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 16, 32, 32)
+ /*, MAKE_STRUCT(tensor_test_params, 1, 8, 511, 399) failed*/)
+ , ::testing::Values<kernel>(MAKE_STRUCT(param_size, 5, 5))
+ , ::testing::Values<stride>(MAKE_STRUCT(param_size, 1, 1)
+ , MAKE_STRUCT(param_size, 2, 2))
+ , ::testing::Values<pad>(MAKE_STRUCT(param_size, 0, 0)
+ /*, MAKE_STRUCT(param_size, 1, 1) failed*/
+ , MAKE_STRUCT(param_size, 2, 2))
+ , ::testing::Values<out_channels>(16, 32)
+ , ::testing::Values<group>(1)
+ , ::testing::Values<dilation_factor>(MAKE_STRUCT(param_size, 1, 2)),
+ ::testing::Values<layoutPreference>(vpu::LayoutPreference::ChannelMinor)
)
);
-INSTANTIATE_TEST_CASE_P(accuracy_7x7, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(accuracy_7x7, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 8, 32, 32)
/*, MAKE_STRUCT(tensor_test_params, 1, 8, 511, 399) failed*/)
)
);
-INSTANTIATE_TEST_CASE_P(accuracy_3x3_large_input_1, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(accuracy_3x3_large_input_1, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 3, 720, 1280))
, ::testing::Values<kernel>(MAKE_STRUCT(param_size, 3, 3))
)
);
-INSTANTIATE_TEST_CASE_P(accuracy_3x3_large_input_2, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(accuracy_3x3_large_input_2, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 24, 357, 637))
, ::testing::Values<kernel>(MAKE_STRUCT(param_size, 3, 3))
);
-INSTANTIATE_TEST_CASE_P(accuracy_3x3_large_input_3, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(accuracy_3x3_large_input_3, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 16, 359, 639))
, ::testing::Values<kernel>(MAKE_STRUCT(param_size, 3, 3))
)
);
-INSTANTIATE_TEST_CASE_P(accuracy_1x1_large_input, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(accuracy_1x1_large_input, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 24, 355, 635))
, ::testing::Values<kernel>(MAKE_STRUCT(param_size, 1, 1))
)
);
-INSTANTIATE_TEST_CASE_P(accuracy_small_input_0, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(accuracy_small_input_0, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 128, 38, 38))
, ::testing::Values<kernel>(MAKE_STRUCT(param_size, 3, 3))
, ::testing::Values<layoutPreference>(vpu::LayoutPreference::ChannelMinor)
)
);
-INSTANTIATE_TEST_CASE_P(accuracy_small_input_1, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(accuracy_small_input_1, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 256, 2, 3))
, ::testing::Values<kernel>(MAKE_STRUCT(param_size, 3, 3))
, ::testing::Values<layoutPreference>(vpu::LayoutPreference::ChannelMinor)
)
);
-INSTANTIATE_TEST_CASE_P(accuracy_small_input_2, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(accuracy_small_input_2, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 256, 2, 2))
, ::testing::Values<kernel>(MAKE_STRUCT(param_size, 3, 3))
, ::testing::Values<layoutPreference>(vpu::LayoutPreference::ChannelMinor)
)
);
-INSTANTIATE_TEST_CASE_P(accuracy_small_input_3, myriadLayerConvolution_smoke,
+INSTANTIATE_TEST_CASE_P(accuracy_small_input_3, myriadLayerConvolution,
::testing::Combine(
::testing::Values<DimsInput>(MAKE_STRUCT(tensor_test_params, 1, 256, 1, 1))
, ::testing::Values<kernel>(MAKE_STRUCT(param_size, 3, 3))
PRETTY_PARAM(dilation_factor, param_size);
PRETTY_PARAM(layoutPreference, vpu::LayoutPreference);
-typedef myriadLayerTestBaseWithParam<tuple<DimsInput, kernel, stride, pad
- , out_channels, group, dilation_factor, layoutPreference >> myriadLayerConvolution_smoke;
-
-typedef myriadLayerTestBaseWithParam<tuple<DimsInput, DimsOutput, kernel, stride, pad
- , group, dilation_factor, layoutPreference >> myriadLayerConvolutionTensorFlow_smoke;
-
-TEST_P(myriadLayerConvolution_smoke, Convolution) {
- tensor_test_params input_dims = get<0>(GetParam());
- param_size kernel = get<1>(GetParam());
- param_size stride = get<2>(GetParam());
- param_size pad = get<3>(GetParam());
- size_t out_channels = get<4>(GetParam());
- size_t group = get<5>(GetParam());
- param_size dilation_factor = get<6>(GetParam());
- vpu::LayoutPreference layoutPreference = get<7>(GetParam());
-
- size_t out_w = (input_dims.w + 2 * pad.x - dilation_factor.x * (kernel.x - 1) - 1 + stride.x) / stride.x;
- size_t out_h = (input_dims.h + 2 * pad.y - dilation_factor.y * (kernel.y - 1) - 1 + stride.y) / stride.y;
-
- tensor_test_params output_dims = {1, out_channels, out_h, out_w};
-
- SetInputTensor(input_dims);
- SetOutputTensor(output_dims);
-
- size_t num_weights = kernel.x * kernel.y * (input_dims.c / group) * output_dims.c;
- size_t num_bias = output_dims.c;
-
- InferenceEngine::TBlob<uint8_t>::Ptr weights_ptr =
- InferenceEngine::TBlob<uint8_t>::Ptr(GenWeights(num_weights + num_bias));
- ie_fp16* weights = weights_ptr->data().as<ie_fp16*>();
- ie_fp16* bias = weights + num_weights;
+class myriadLayerConvolutionBase : public myriadLayerTestBaseWithParam<
+ tuple<DimsInput, kernel, stride, pad, out_channels, group, dilation_factor, layoutPreference>>
+{
+public:
+ void testConvolution() {
+ tensor_test_params input_dims = get<0>(GetParam());
+ param_size kernel = get<1>(GetParam());
+ param_size stride = get<2>(GetParam());
+ param_size pad = get<3>(GetParam());
+ size_t out_channels = get<4>(GetParam());
+ size_t group = get<5>(GetParam());
+ param_size dilation_factor = get<6>(GetParam());
+ vpu::LayoutPreference layoutPreference = get<7>(GetParam());
+
+ size_t out_w = (input_dims.w + 2 * pad.x - dilation_factor.x * (kernel.x - 1) - 1 + stride.x) / stride.x;
+ size_t out_h = (input_dims.h + 2 * pad.y - dilation_factor.y * (kernel.y - 1) - 1 + stride.y) / stride.y;
+
+ tensor_test_params output_dims = {1, out_channels, out_h, out_w};
+
+ SetInputTensor(input_dims);
+ SetOutputTensor(output_dims);
+
+ size_t num_weights = kernel.x * kernel.y * (input_dims.c / group) * output_dims.c;
+ size_t num_bias = output_dims.c;
+
+ InferenceEngine::TBlob<uint8_t>::Ptr weights_ptr =
+ InferenceEngine::TBlob<uint8_t>::Ptr(GenWeights(num_weights + num_bias));
+ ie_fp16* weights = weights_ptr->data().as<ie_fp16*>();
+ ie_fp16* bias = weights + num_weights;
+
+ std::map<std::string, std::string> layer_params = {
+ {"kernel-x", std::to_string(kernel.x)}
+ , {"kernel-y", std::to_string(kernel.y)}
+ , {"stride-x", std::to_string(stride.x)}
+ , {"stride-y", std::to_string(stride.y)}
+ , {"pad-x", std::to_string(pad.x)}
+ , {"pad-y", std::to_string(pad.y)}
+ , {"output", std::to_string(out_channels)}
+ , {"group", std::to_string(group)}
+ , {"dilation-x", std::to_string(dilation_factor.x)}
+ , {"dilation-y", std::to_string(dilation_factor.y)}
+ };
+ ASSERT_NO_FATAL_FAILURE(makeSingleLayerNetwork(LayerInitParams("Convolution")
+ .params(layer_params)
+ .weights(num_weights)
+ .biases(num_bias),
+ {},
+ weights_ptr));
+ SetFirstInputToRange(-0.9f, 0.9f);
+
+ ASSERT_TRUE(Infer());
+ auto inputBlob = _inputMap.begin()->second;
+ auto outputBlob = _outputMap.begin()->second;
+
+ ref_convolution(inputBlob, _refBlob, weights, bias, kernel, stride, pad, group, dilation_factor);
+
+ float maxerr = 0;
+
+ if (group == 1)
+ maxerr = 0.00055 * input_dims.c * kernel.x * kernel.y;
+ else // TODO: currently dephConv is slightly less accurate
+ maxerr = 0.00066 * (input_dims.c / group) * kernel.x * kernel.y;
+
+ CompareCommonAbsolute(outputBlob, _refBlob, maxerr);
+ }
+};
- std::map<std::string, std::string> layer_params = {
- {"kernel-x", std::to_string(kernel.x)}
- , {"kernel-y", std::to_string(kernel.y)}
- , {"stride-x", std::to_string(stride.x)}
- , {"stride-y", std::to_string(stride.y)}
- , {"pad-x", std::to_string(pad.x)}
- , {"pad-y", std::to_string(pad.y)}
- , {"output", std::to_string(out_channels)}
- , {"group", std::to_string(group)}
- , {"dilation-x", std::to_string(dilation_factor.x)}
- , {"dilation-y", std::to_string(dilation_factor.y)}
- };
- ASSERT_NO_FATAL_FAILURE(makeSingleLayerNetwork(LayerInitParams("Convolution")
- .params(layer_params)
- .weights(num_weights)
- .biases(num_bias),
- {},
- weights_ptr));
- SetFirstInputToRange(-0.9f, 0.9f);
+class myriadLayerConvolution : public myriadLayerConvolutionBase {};
- ASSERT_TRUE(Infer());
- auto inputBlob = _inputMap.begin()->second;
- auto outputBlob = _outputMap.begin()->second;
+TEST_P(myriadLayerConvolution, Convolution) {
+ testConvolution();
+}
- ref_convolution(inputBlob, _refBlob, weights, bias, kernel, stride, pad, group, dilation_factor);
+class myriadLayerConvolution_smoke : public myriadLayerConvolutionBase {};
- float maxerr = 0;
+TEST_P(myriadLayerConvolution_smoke, Convolution) {
+ testConvolution();
+}
- if (group == 1)
- maxerr = 0.00055 * input_dims.c * kernel.x * kernel.y;
- else // TODO: currently dephConv is slightly less accurate
- maxerr = 0.00066 * (input_dims.c / group) * kernel.x * kernel.y;
- CompareCommonAbsolute(outputBlob, _refBlob, maxerr);
-}
+class myriadLayerConvolutionTensorFlow :
+ public myriadLayerTestBaseWithParam<tuple<DimsInput, DimsOutput, kernel, stride,
+ pad, group, dilation_factor, layoutPreference >> {};
-TEST_P(myriadLayerConvolutionTensorFlow_smoke, Convolution) {
+TEST_P(myriadLayerConvolutionTensorFlow, Convolution) {
tensor_test_params input_dims = get<0>(GetParam());
tensor_test_params output_dims = get<1>(GetParam());
param_size kernel = get<2>(GetParam());