Browse Source

ctest 8

pull/5872/head
佰阅 1 year ago
parent
commit
ad65148c29
2 changed files with 11 additions and 39 deletions
  1. +5
    -37
      tests/test_flip.cpp
  2. +6
    -2
      tools/pnnx/tests/ncnn/test_torch_flip.py

+ 5
- 37
tests/test_flip.cpp View File

@@ -124,41 +124,9 @@ static int test_flip_3()
int main()
{
SRAND(7767517);
// return 0
// || test_flip_0()
// || test_flip_1()
// || test_flip_2()
// || test_flip_3();

// debug 测出所有异常
test_flip(RandomMat(2, 3, 4, 5), IntArrayMat(0));
test_flip(RandomMat(3, 2, 4, 5), IntArrayMat(1));
test_flip(RandomMat(4, 3, 2, 5), IntArrayMat(2));
test_flip(RandomMat(2, 3, 1, 5), IntArrayMat(3));
test_flip(RandomMat(6, 3, 4, 5), IntArrayMat(0, 1));
test_flip(RandomMat(2, 3, 1, 6), IntArrayMat(0, 2));
test_flip(RandomMat(5, 1, 2, 5), IntArrayMat(0, 3));
test_flip(RandomMat(5, 2, 1, 5), IntArrayMat(1, 2));
test_flip(RandomMat(4, 5, 2, 3), IntArrayMat(1, 3));
test_flip(RandomMat(2, 6, 4, 5), IntArrayMat(2, 3));
test_flip(RandomMat(6, 1, 4, 5), IntArrayMat(0, 1, 2));
test_flip(RandomMat(5, 2, 1, 5), IntArrayMat(0, 1, 3));
test_flip(RandomMat(4, 3, 3, 5), IntArrayMat(0, 2, 3));
test_flip(RandomMat(4, 3, 4, 5), IntArrayMat(1, 2, 3));
test_flip(RandomMat(6, 3, 3, 2), IntArrayMat(0, 1, 2, 3));

test_flip(RandomMat(2, 3, 5), IntArrayMat(0));
test_flip(RandomMat(3, 3, 5), IntArrayMat(1));
test_flip(RandomMat(4, 3, 5), IntArrayMat(2));
test_flip(RandomMat(3, 1, 5), IntArrayMat(0, 1));
test_flip(RandomMat(3, 2, 5), IntArrayMat(0, 2));
test_flip(RandomMat(3, 3, 4), IntArrayMat(1, 2));
test_flip(RandomMat(4, 3, 2), IntArrayMat(0, 1, 2));

test_flip(RandomMat(8, 2), IntArrayMat(-2));
test_flip(RandomMat(16, 3), IntArrayMat(-1));
test_flip(RandomMat(7, 2), IntArrayMat(-2, -1));

test_flip(RandomMat(18), IntArrayMat(-1));
return -1;
return 0
|| test_flip_0()
|| test_flip_1()
|| test_flip_2()
|| test_flip_3();
}

+ 6
- 2
tools/pnnx/tests/ncnn/test_torch_flip.py View File

@@ -66,6 +66,7 @@ class Model(nn.Module):
z3 = torch.flip(z, [0, 1])
z4 = torch.flip(z, [0, 2])
z5 = torch.flip(z, [1, 2])
z6 = torch.flip(z, [0, 1, 2])
# 4D
d0 = torch.flip(d, [-1])
d1 = torch.flip(d, [-2])
@@ -79,8 +80,9 @@ class Model(nn.Module):
d9 = torch.flip(d, [2, 3])
d10 = torch.flip(d, [0, 1, 2])
d11 = torch.flip(d, [0, 1, 3])
d12 = torch.flip(d, [1, 2, 3])
d13 = torch.flip(d, [0, 1, 2, 3])
d12 = torch.flip(d, [0, 2, 3])
d13 = torch.flip(d, [1, 2, 3])
d14 = torch.flip(d, [0, 1, 2, 3])

return (
x0,
@@ -93,6 +95,7 @@ class Model(nn.Module):
z3,
z4,
z5,
z6,
d0,
d1,
d2,
@@ -107,6 +110,7 @@ class Model(nn.Module):
d11,
d12,
d13,
d14,
)




Loading…
Cancel
Save