Use designated initializers for TensorsToSegmentationCalculator tests.
PiperOrigin-RevId: 576671943
This commit is contained in:
parent
a277d853ea
commit
e7121e4feb
|
@ -152,103 +152,96 @@ TEST_P(TensorsToSegmentationCalculatorTest, ParameterizedTests) {
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
TensorsToSegmentationCalculatorTests, TensorsToSegmentationCalculatorTest,
|
TensorsToSegmentationCalculatorTests, TensorsToSegmentationCalculatorTest,
|
||||||
testing::ValuesIn<FormattingTestCase>({
|
testing::ValuesIn<FormattingTestCase>({
|
||||||
{/*test_name=*/"NoActivationAndNoOutputResize",
|
{.test_name = "NoActivationAndNoOutputResize",
|
||||||
/*inputs=*/
|
.inputs = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0,
|
||||||
{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
|
12.0, 13.0, 14.0, 15.0, 16.0},
|
||||||
14.0, 15.0, 16.0},
|
.expected_outputs = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
|
||||||
/*expected_outputs=*/
|
11.0, 12.0, 13.0, 14.0, 15.0, 16.0},
|
||||||
{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
|
.activation = Options::NONE,
|
||||||
14.0, 15.0, 16.0},
|
.rows = 4,
|
||||||
/*activation=*/Options::NONE,
|
.cols = 4,
|
||||||
/*rows=*/4,
|
.rows_new = 4,
|
||||||
/*cols=*/4,
|
.cols_new = 4,
|
||||||
/*rows_new=*/4,
|
.channels = 1,
|
||||||
/*cols_new=*/4,
|
.max_abs_diff = 1e-7},
|
||||||
/*channels=*/1,
|
{.test_name = "OutputResizeOnly",
|
||||||
/*max_abs_diff=*/1e-7},
|
.inputs = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0,
|
||||||
{/*test_name=*/"OutputResizeOnly",
|
12.0, 13.0, 14.0, 15.0, 16.0},
|
||||||
/*inputs=*/
|
.expected_outputs = {1, 1.5, 2.166667, 2.833333, 3.5, 4,
|
||||||
{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
|
|
||||||
14.0, 15.0, 16.0},
|
|
||||||
/*expected_outputs=*/
|
|
||||||
{1, 1.5, 2.166667, 2.833333, 3.5, 4,
|
|
||||||
3.8, 4.3, 4.966667, 5.633333, 6.3, 6.8,
|
3.8, 4.3, 4.966667, 5.633333, 6.3, 6.8,
|
||||||
7, 7.5, 8.166667, 8.833333, 9.5, 10,
|
7, 7.5, 8.166667, 8.833333, 9.5, 10,
|
||||||
10.2, 10.7, 11.366667, 12.033333, 12.7, 13.2,
|
10.2, 10.7, 11.366667, 12.033333, 12.7, 13.2,
|
||||||
13, 13.5, 14.166667, 14.833333, 15.5, 16},
|
13, 13.5, 14.166667, 14.833333, 15.5, 16},
|
||||||
/*activation=*/Options::NONE,
|
.activation = Options::NONE,
|
||||||
/*rows=*/4,
|
.rows = 4,
|
||||||
/*cols=*/4,
|
.cols = 4,
|
||||||
/*rows_new=*/5,
|
.rows_new = 5,
|
||||||
/*cols_new=*/6,
|
.cols_new = 6,
|
||||||
/*channels=*/1,
|
.channels = 1,
|
||||||
/*max_abs_diff=*/1e-6},
|
.max_abs_diff = 1e-6},
|
||||||
{/*test_name=*/"SigmoidActivationWithNoOutputResize",
|
{.test_name = "SigmoidActivationWithNoOutputResize",
|
||||||
/*inputs=*/
|
.inputs = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0,
|
||||||
{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
|
12.0, 13.0, 14.0, 15.0, 16.0},
|
||||||
14.0, 15.0, 16.0},
|
.expected_outputs = {0.731059, 0.880797, 0.952574, 0.982014, 0.993307,
|
||||||
/*expected_outputs=*/
|
0.997527, 0.999089, 0.999665, 0.999877, 0.999955,
|
||||||
{0.731059, 0.880797, 0.952574, 0.982014, 0.993307, 0.997527, 0.999089,
|
0.999983, 0.999994, 0.999998, 0.999999, 1.0, 1.0},
|
||||||
0.999665, 0.999877, 0.999955, 0.999983, 0.999994, 0.999998, 0.999999,
|
.activation = Options::SIGMOID,
|
||||||
1.0, 1.0},
|
.rows = 4,
|
||||||
/*activation=*/Options::SIGMOID,
|
.cols = 4,
|
||||||
/*rows=*/4,
|
.rows_new = 4,
|
||||||
/*cols=*/4,
|
.cols_new = 4,
|
||||||
/*rows_new=*/4,
|
.channels = 1,
|
||||||
/*cols_new=*/4,
|
.max_abs_diff = 1e-6},
|
||||||
/*channels=*/1,
|
{.test_name = "SigmoidActivationWithOutputResize",
|
||||||
/*max_abs_diff=*/1e-6},
|
.inputs = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0,
|
||||||
{/*test_name=*/"SigmoidActivationWithOutputResize",
|
12.0, 13.0, 14.0, 15.0, 16.0},
|
||||||
/*inputs=*/
|
.expected_outputs = {0.731059, 0.805928, 0.89276, 0.940611, 0.967294,
|
||||||
{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
|
0.982014, 0.914633, 0.93857, 0.966279, 0.981363,
|
||||||
14.0, 15.0, 16.0},
|
0.989752, 0.994369, 0.996592, 0.997666, 0.998873,
|
||||||
/*expected_outputs=*/
|
0.999404, 0.999683, 0.999829, 0.999913, 0.99994,
|
||||||
{0.731059, 0.805928, 0.89276, 0.940611, 0.967294, 0.982014,
|
0.999971, 0.999985, 0.999992, 0.999996, 0.999998,
|
||||||
0.914633, 0.93857, 0.966279, 0.981363, 0.989752, 0.994369,
|
0.999998, 0.999999, 1.0, 1.0, 1.0},
|
||||||
0.996592, 0.997666, 0.998873, 0.999404, 0.999683, 0.999829,
|
.activation = Options::SIGMOID,
|
||||||
0.999913, 0.99994, 0.999971, 0.999985, 0.999992, 0.999996,
|
.rows = 4,
|
||||||
0.999998, 0.999998, 0.999999, 1.0, 1.0, 1.0},
|
.cols = 4,
|
||||||
/*activation=*/Options::SIGMOID,
|
.rows_new = 5,
|
||||||
/*rows=*/4,
|
.cols_new = 6,
|
||||||
/*cols=*/4,
|
.channels = 1,
|
||||||
/*rows_new=*/5,
|
.max_abs_diff = 1e-6},
|
||||||
/*cols_new=*/6,
|
{.test_name = "SoftmaxActivationWithNoOutputResize",
|
||||||
/*channels=*/1,
|
.inputs = {1.0, 2.0, 4.0, 2.0, 3.0, 5.0, 6.0, 1.5,
|
||||||
/*max_abs_diff=*/1e-6},
|
7.0, 10.0, 11.0, 4.0, 12.0, 15.0, 16.0, 18.5,
|
||||||
{/*test_name=*/"SoftmaxActivationWithNoOutputResize",
|
19.0, 20.0, 22.0, 23.0, 24.5, 23.4, 25.6, 28.3,
|
||||||
/*inputs=*/
|
29.2, 30.0, 24.6, 29.2, 30.0, 24.9, 31.2, 30.3},
|
||||||
{1.0, 2.0, 4.0, 2.0, 3.0, 5.0, 6.0, 1.5, 7.0, 10.0, 11.0,
|
.expected_outputs = {0.731059, 0.119203, 0.880797, 0.0109869, 0.952574,
|
||||||
4.0, 12.0, 15.0, 16.0, 18.5, 19.0, 20.0, 22.0, 23.0, 24.5, 23.4,
|
0.000911051, 0.952574, 0.924142, 0.731059,
|
||||||
25.6, 28.3, 29.2, 30.0, 24.6, 29.2, 30.0, 24.9, 31.2, 30.3},
|
0.731059, 0.24974, 0.937027, 0.689974, 0.990048,
|
||||||
/*expected_outputs=*/
|
0.0060598, 0.28905},
|
||||||
{0.731059, 0.119203, 0.880797, 0.0109869, 0.952574, 0.000911051,
|
.activation = Options::SOFTMAX,
|
||||||
0.952574, 0.924142, 0.731059, 0.731059, 0.24974, 0.937027, 0.689974,
|
.rows = 4,
|
||||||
0.990048, 0.0060598, 0.28905},
|
.cols = 4,
|
||||||
/*activation=*/Options::SOFTMAX,
|
.rows_new = 4,
|
||||||
/*rows=*/4,
|
.cols_new = 4,
|
||||||
/*cols=*/4,
|
.channels = 2,
|
||||||
/*rows_new=*/4,
|
.max_abs_diff = 1e-6},
|
||||||
/*cols_new=*/4,
|
{.test_name = "SoftmaxActivationWithOutputResize",
|
||||||
/*channels=*/2,
|
.inputs = {1.0, 2.0, 4.0, 2.0, 3.0, 5.0, 6.0, 1.5,
|
||||||
/*max_abs_diff=*/1e-6},
|
7.0, 10.0, 11.0, 4.0, 12.0, 15.0, 16.0, 18.5,
|
||||||
{/*test_name=*/"SoftmaxActivationWithOutputResize",
|
19.0, 20.0, 22.0, 23.0, 24.5, 23.4, 25.6, 28.3,
|
||||||
/*inputs=*/
|
29.2, 30.0, 24.6, 29.2, 30.0, 24.9, 31.2, 30.3},
|
||||||
{1.0, 2.0, 4.0, 2.0, 3.0, 5.0, 6.0, 1.5, 7.0, 10.0, 11.0,
|
.expected_outputs = {0.731059, 0.425131, 0.246135, 0.753865, 0.445892,
|
||||||
4.0, 12.0, 15.0, 16.0, 18.5, 19.0, 20.0, 22.0, 23.0, 24.5, 23.4,
|
0.0109869, 0.886119, 0.461259, 0.185506, 0.781934,
|
||||||
25.6, 28.3, 29.2, 30.0, 24.6, 29.2, 30.0, 24.9, 31.2, 30.3},
|
0.790618, 0.650195, 0.841816, 0.603901, 0.40518,
|
||||||
/*expected_outputs=*/
|
0.561962, 0.765871, 0.930584, 0.718733, 0.763744,
|
||||||
{0.731059, 0.425131, 0.246135, 0.753865, 0.445892, 0.0109869,
|
0.703402, 0.281989, 0.459635, 0.742634, 0.689974,
|
||||||
0.886119, 0.461259, 0.185506, 0.781934, 0.790618, 0.650195,
|
0.840011, 0.82605, 0.170058, 0.147555, 0.28905},
|
||||||
0.841816, 0.603901, 0.40518, 0.561962, 0.765871, 0.930584,
|
.activation = Options::SOFTMAX,
|
||||||
0.718733, 0.763744, 0.703402, 0.281989, 0.459635, 0.742634,
|
.rows = 4,
|
||||||
0.689974, 0.840011, 0.82605, 0.170058, 0.147555, 0.28905},
|
.cols = 4,
|
||||||
/*activation=*/Options::SOFTMAX,
|
.rows_new = 5,
|
||||||
/*rows=*/4,
|
.cols_new = 6,
|
||||||
/*cols=*/4,
|
.channels = 2,
|
||||||
/*rows_new=*/5,
|
.max_abs_diff = 1e-6},
|
||||||
/*cols_new=*/6,
|
|
||||||
/*channels=*/2,
|
|
||||||
/*max_abs_diff=*/1e-6},
|
|
||||||
}),
|
}),
|
||||||
[](const testing::TestParamInfo<
|
[](const testing::TestParamInfo<
|
||||||
TensorsToSegmentationCalculatorTest::ParamType>& info) {
|
TensorsToSegmentationCalculatorTest::ParamType>& info) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user