mirror of
https://github.com/opencv/opencv.git
synced 2025-01-19 15:04:01 +08:00
git squash
This commit is contained in:
parent
719830959c
commit
a31f4f4040
@ -480,4 +480,37 @@ INSTANTIATE_TEST_CASE_P(/*nothing*/, Layer_Scatter_Test, Combine(
|
||||
|
||||
|
||||
|
||||
typedef testing::TestWithParam<tuple<std::vector<int>>> Layer_Permute_Test;
|
||||
TEST_P(Layer_Permute_Test, Accuracy_01D)
|
||||
{
|
||||
LayerParams lp;
|
||||
lp.type = "Permute";
|
||||
lp.name = "PermuteLayer";
|
||||
|
||||
int order[] = {0}; // Since it's a 0D tensor, the order remains [0]
|
||||
lp.set("order", DictValue::arrayInt(order, 1));
|
||||
Ptr<PermuteLayer> layer = PermuteLayer::create(lp);
|
||||
|
||||
std::vector<int> input_shape = get<0>(GetParam());
|
||||
|
||||
Mat input = Mat(input_shape.size(), input_shape.data(), CV_32F);
|
||||
cv::randn(input, 0.0, 1.0);
|
||||
Mat output_ref = input.clone();
|
||||
|
||||
std::vector<Mat> inputs{input};
|
||||
std::vector<Mat> outputs;
|
||||
|
||||
runLayer(layer, inputs, outputs);
|
||||
ASSERT_EQ(outputs.size(), 1);
|
||||
ASSERT_EQ(shape(output_ref), shape(outputs[0]));
|
||||
normAssert(output_ref, outputs[0]);
|
||||
}
|
||||
INSTANTIATE_TEST_CASE_P(/*nothing*/, Layer_Permute_Test,
|
||||
/*input blob shape*/ testing::Values(
|
||||
std::vector<int>{},
|
||||
std::vector<int>{1},
|
||||
std::vector<int>{1, 4},
|
||||
std::vector<int>{4, 1}
|
||||
));
|
||||
|
||||
}}
|
||||
|
Loading…
Reference in New Issue
Block a user