|
8 | 8 | class TestUpsampleConverter(DispatchTestCase):
|
9 | 9 | @parameterized.expand(
|
10 | 10 | [
|
11 |
| - ((2,), (4,)), |
12 |
| - ((2,), (5,)), |
| 11 | + ((2,), (4,), None), |
| 12 | + ((2,), (5,), None), |
| 13 | + ((2,), (4,), 2.0), |
| 14 | + ((2,), (5,), 2.5), |
13 | 15 | ]
|
14 | 16 | )
|
15 |
| - def test_nearest1d(self, input_shape, output_size): |
| 17 | + def test_nearest1d(self, input_shape, output_size, scales): |
16 | 18 | class Upsample(torch.nn.Module):
|
17 | 19 | def forward(self, input):
|
18 |
| - return torch.ops.aten.upsample_nearest1d.default(input, output_size) |
| 20 | + return torch.ops.aten.upsample_nearest1d.default( |
| 21 | + input, output_size, scales |
| 22 | + ) |
19 | 23 |
|
20 | 24 | input = [torch.randn([1, 1] + list(input_shape))]
|
21 | 25 | self.run_test(Upsample(), input)
|
22 | 26 |
|
23 | 27 | @parameterized.expand(
|
24 | 28 | [
|
25 |
| - ((2, 2), (4, 4)), |
26 |
| - ((2, 2), (5, 5)), |
| 29 | + ((2, 2), (4, 4), None, None), |
| 30 | + ((2, 2), (5, 5), None, None), |
| 31 | + ((2, 2), (4, 4), 2.0, 2.0), |
| 32 | + ((2, 2), (5, 5), 2.5, 2.5), |
27 | 33 | ]
|
28 | 34 | )
|
29 |
| - def test_nearest2d(self, input_shape, output_size): |
| 35 | + def test_nearest2d(self, input_shape, output_size, scales_h, scales_w): |
30 | 36 | class Upsample(torch.nn.Module):
|
31 | 37 | def forward(self, input):
|
32 |
| - return torch.ops.aten.upsample_nearest2d.default(input, output_size) |
| 38 | + return torch.ops.aten.upsample_nearest2d.default( |
| 39 | + input, output_size, scales_h, scales_w |
| 40 | + ) |
33 | 41 |
|
34 | 42 | input = [torch.randn([1, 1] + list(input_shape))]
|
35 | 43 | self.run_test(Upsample(), input)
|
36 | 44 |
|
37 | 45 | @parameterized.expand(
|
38 | 46 | [
|
39 |
| - ((2, 2, 2), (4, 4, 4)), |
40 |
| - ((2, 2, 2), (5, 5, 5)), |
| 47 | + ((2, 2, 2), (4, 4, 4), None, None, None), |
| 48 | + ((2, 2, 2), (5, 5, 5), None, None, None), |
| 49 | + ((2, 2, 2), (4, 4, 4), 2.0, 2.0, 2.0), |
| 50 | + ((2, 2, 2), (5, 5, 5), 2.5, 2.5, 2.5), |
41 | 51 | ]
|
42 | 52 | )
|
43 |
| - def test_nearest3d(self, input_shape, output_size): |
| 53 | + def test_nearest3d(self, input_shape, output_size, scales_d, scales_h, scales_w): |
44 | 54 | class Upsample(torch.nn.Module):
|
45 | 55 | def forward(self, input):
|
46 |
| - return torch.ops.aten.upsample_nearest3d.default(input, output_size) |
| 56 | + return torch.ops.aten.upsample_nearest3d.default( |
| 57 | + input, output_size, scales_d, scales_h, scales_w |
| 58 | + ) |
47 | 59 |
|
48 | 60 | input = [torch.randn([1, 1] + list(input_shape))]
|
49 | 61 | self.run_test(Upsample(), input)
|
50 | 62 |
|
51 | 63 | @parameterized.expand(
|
52 | 64 | [
|
53 |
| - ((2,), (4,), True), |
54 |
| - ((2,), (4,), False), |
55 |
| - ((2,), (5,), True), |
56 |
| - ((2,), (5,), False), |
| 65 | + ((2,), (4,), True, None), |
| 66 | + ((2,), (4,), False, None), |
| 67 | + ((2,), (5,), True, None), |
| 68 | + ((2,), (5,), False, None), |
| 69 | + ((2,), (4,), True, 2.0), |
| 70 | + ((2,), (4,), False, 2.0), |
| 71 | + ((2,), (5,), True, 2.5), |
| 72 | + ((2,), (5,), False, 2.5), |
57 | 73 | ]
|
58 | 74 | )
|
59 |
| - def test_linear1d(self, input_shape, output_size, align_corners): |
| 75 | + def test_linear1d(self, input_shape, output_size, align_corners, scales): |
60 | 76 | class Upsample(torch.nn.Module):
|
61 | 77 | def forward(self, input):
|
62 | 78 | return torch.ops.aten.upsample_linear1d.default(
|
63 |
| - input, output_size, align_corners |
| 79 | + input, output_size, align_corners, scales |
64 | 80 | )
|
65 | 81 |
|
66 | 82 | input = [torch.randn([1, 1] + list(input_shape))]
|
67 | 83 | self.run_test(Upsample(), input)
|
68 | 84 |
|
69 | 85 | @parameterized.expand(
|
70 | 86 | [
|
71 |
| - ((2, 2), (4, 4), True), |
72 |
| - ((2, 2), (4, 4), False), |
73 |
| - ((2, 2), (5, 5), True), |
74 |
| - ((2, 2), (5, 5), False), |
| 87 | + ((2, 2), (4, 4), True, None, None), |
| 88 | + ((2, 2), (4, 4), False, None, None), |
| 89 | + ((2, 2), (5, 5), True, None, None), |
| 90 | + ((2, 2), (5, 5), False, None, None), |
| 91 | + ((2, 2), (4, 4), True, 2.0, 2.0), |
| 92 | + ((2, 2), (4, 4), False, 2.0, 2.0), |
| 93 | + ((2, 2), (5, 5), True, 2.5, 2.5), |
| 94 | + ((2, 2), (5, 5), False, 2.5, 2.5), |
75 | 95 | ]
|
76 | 96 | )
|
77 |
| - def test_bilinear2d(self, input_shape, output_size, align_corners): |
| 97 | + def test_bilinear2d( |
| 98 | + self, input_shape, output_size, align_corners, scales_h, scales_w |
| 99 | + ): |
78 | 100 | class Upsample(torch.nn.Module):
|
79 | 101 | def forward(self, input):
|
80 | 102 | return torch.ops.aten.upsample_bilinear2d.default(
|
81 |
| - input, output_size, align_corners |
| 103 | + input, output_size, align_corners, scales_h, scales_w |
82 | 104 | )
|
83 | 105 |
|
84 | 106 | input = [torch.randn([1, 1] + list(input_shape))]
|
85 | 107 | self.run_test(Upsample(), input)
|
86 | 108 |
|
87 | 109 | @parameterized.expand(
|
88 | 110 | [
|
89 |
| - ((2, 2, 2), (4, 4, 4), True), |
90 |
| - ((2, 2, 2), (4, 4, 4), False), |
91 |
| - ((2, 2, 2), (5, 5, 5), True), |
92 |
| - ((2, 2, 2), (5, 5, 5), False), |
| 111 | + ((2, 2, 2), (4, 4, 4), True, None, None, None), |
| 112 | + ((2, 2, 2), (4, 4, 4), False, None, None, None), |
| 113 | + ((2, 2, 2), (5, 5, 5), True, None, None, None), |
| 114 | + ((2, 2, 2), (5, 5, 5), False, None, None, None), |
| 115 | + ((2, 2, 2), (4, 4, 4), True, 2.0, 2.0, 2.0), |
| 116 | + ((2, 2, 2), (4, 4, 4), False, 2.0, 2.0, 2.0), |
| 117 | + ((2, 2, 2), (5, 5, 5), True, 2.5, 2.5, 2.5), |
| 118 | + ((2, 2, 2), (5, 5, 5), False, 2.5, 2.5, 2.5), |
93 | 119 | ]
|
94 | 120 | )
|
95 |
| - def test_trilinear3d(self, input_shape, output_size, align_corners): |
| 121 | + def test_trilinear3d( |
| 122 | + self, input_shape, output_size, align_corners, scales_d, scales_h, scales_w |
| 123 | + ): |
96 | 124 | class Upsample(torch.nn.Module):
|
97 | 125 | def forward(self, input):
|
98 | 126 | return torch.ops.aten.upsample_trilinear3d.default(
|
99 |
| - input, output_size, align_corners |
| 127 | + input, output_size, align_corners, scales_d, scales_h, scales_w |
100 | 128 | )
|
101 | 129 |
|
102 | 130 | input = [torch.randn([1, 1] + list(input_shape))]
|
103 | 131 | self.run_test(Upsample(), input)
|
104 | 132 |
|
105 | 133 | @parameterized.expand(
|
106 | 134 | [
|
107 |
| - ((2, 2), (4, 4), True), |
108 |
| - ((2, 2), (4, 4), False), |
109 |
| - ((2, 2), (5, 5), True), |
110 |
| - ((2, 2), (5, 5), False), |
| 135 | + ((2, 2), (4, 4), True, None, None), |
| 136 | + ((2, 2), (4, 4), False, None, None), |
| 137 | + ((2, 2), (5, 5), True, None, None), |
| 138 | + ((2, 2), (5, 5), False, None, None), |
| 139 | + ((2, 2), (4, 4), True, 2.0, 2.0), |
| 140 | + ((2, 2), (4, 4), False, 2.0, 2.0), |
| 141 | + ((2, 2), (5, 5), True, 2.5, 2.5), |
| 142 | + ((2, 2), (5, 5), False, 2.5, 2.5), |
111 | 143 | ]
|
112 | 144 | )
|
113 |
| - def test_bicubic2d(self, input_shape, output_size, align_corners): |
| 145 | + def test_bicubic2d( |
| 146 | + self, input_shape, output_size, align_corners, scales_h, scales_w |
| 147 | + ): |
114 | 148 | class Upsample(torch.nn.Module):
|
115 | 149 | def forward(self, input):
|
116 | 150 | return torch.ops.aten.upsample_bicubic2d.default(
|
117 |
| - input, output_size, align_corners |
| 151 | + input, output_size, align_corners, scales_h, scales_w |
118 | 152 | )
|
119 | 153 |
|
120 | 154 | input = [torch.randn([1, 1] + list(input_shape))]
|
|
0 commit comments