@@ -12,6 +12,18 @@ func.func @unary_resize_nearest_fp32(%arg0 : tensor<3x1x1x7xf32>) -> tensor<3x1x
12
12
13
13
// -----
14
14
15
+ // CHECK-LABEL: @unary_resize_nearest_bf16
16
+ func.func @unary_resize_nearest_bf16 (%arg0 : tensor <3 x1 x1 x7 xbf16 >) -> tensor <3 x1 x1 x7 xbf16 > {
17
+ %scale = tosa.const_shape { values = dense <[2 , 2 , 1 , 1 ]> : tensor <4 xindex > } : () -> !tosa.shape <4 >
18
+ %offset = tosa.const_shape { values = dense <0 > : tensor <2 xindex > } : () -> !tosa.shape <2 >
19
+ %border = tosa.const_shape { values = dense <0 > : tensor <2 xindex > } : () -> !tosa.shape <2 >
20
+ %resize = tosa.resize %arg0 , %scale , %offset , %border {mode = NEAREST_NEIGHBOR } : (tensor <3 x1 x1 x7 xbf16 >, !tosa.shape <4 >, !tosa.shape <2 >, !tosa.shape <2 >) -> tensor <3 x1 x1 x7 xbf16 >
21
+ // CHECK: return %arg0
22
+ return %resize : tensor <3 x1 x1 x7 xbf16 >
23
+ }
24
+
25
+ // -----
26
+
15
27
// CHECK-LABEL: @unary_resize_nearest_fp16
16
28
func.func @unary_resize_nearest_fp16 (%arg0 : tensor <3 x1 x1 x7 xf16 >) -> tensor <3 x1 x1 x7 xf16 > {
17
29
%scale = tosa.const_shape { values = dense <[2 , 2 , 1 , 1 ]> : tensor <4 xindex > } : () -> !tosa.shape <4 >
@@ -36,6 +48,18 @@ func.func @unary_resize_bilinear_fp32(%arg0 : tensor<3x1x1x7xf32>) -> tensor<3x1
36
48
37
49
// -----
38
50
51
+ // CHECK-LABEL: @unary_resize_bilinear_bf16
52
+ func.func @unary_resize_bilinear_bf16 (%arg0 : tensor <3 x1 x1 x7 xbf16 >) -> tensor <3 x1 x1 x7 xbf16 > {
53
+ %scale = tosa.const_shape { values = dense <[2 , 2 , 1 , 1 ]> : tensor <4 xindex > } : () -> !tosa.shape <4 >
54
+ %offset = tosa.const_shape { values = dense <0 > : tensor <2 xindex > } : () -> !tosa.shape <2 >
55
+ %border = tosa.const_shape { values = dense <0 > : tensor <2 xindex > } : () -> !tosa.shape <2 >
56
+ %resize = tosa.resize %arg0 , %scale , %offset , %border {mode = BILINEAR } : (tensor <3 x1 x1 x7 xbf16 >, !tosa.shape <4 >, !tosa.shape <2 >, !tosa.shape <2 >) -> tensor <3 x1 x1 x7 xbf16 >
57
+ // CHECK: return %arg0
58
+ return %resize : tensor <3 x1 x1 x7 xbf16 >
59
+ }
60
+
61
+ // -----
62
+
39
63
// CHECK-LABEL: @unary_resize_bilinear_fp16
40
64
func.func @unary_resize_bilinear_fp16 (%arg0 : tensor <3 x1 x1 x7 xf16 >) -> tensor <3 x1 x1 x7 xf16 > {
41
65
%scale = tosa.const_shape { values = dense <[2 , 2 , 1 , 1 ]> : tensor <4 xindex > } : () -> !tosa.shape <4 >
@@ -60,6 +84,26 @@ func.func @unary_resize_nearest_i8(%arg0 : tensor<3x1x1x7xi8>) -> tensor<3x1x1x7
60
84
61
85
// -----
62
86
87
+ // CHECK-LABEL: @broadcast_resize_nearest_bf16
88
+ func.func @broadcast_resize_nearest_bf16 (%arg0 : tensor <3 x1 x1 x7 xbf16 >) -> tensor <3 x1 x5 x7 xbf16 > {
89
+ // CHECK: %[[COLLAPSE:.+]] = tensor.collapse_shape %arg0
90
+ // CHECK-NEXT{literal}: [[0], [1, 2, 3]] : tensor<3x1x1x7xbf16> into tensor<3x7xbf16>
91
+ // CHECK: %[[EMPTY:.+]] = tensor.empty() : tensor<3x1x5x7xbf16>
92
+ // CHECK: %[[GENERIC:.+]] = linalg.generic
93
+ // CHECK-SAME: indexing_maps = [#map, #map1], iterator_types = ["parallel", "parallel", "parallel", "parallel"]}
94
+ // CHECK-SAME: ins(%[[COLLAPSE]] : tensor<3x7xbf16>) outs(%[[EMPTY]] : tensor<3x1x5x7xbf16>)
95
+ // CHECK: ^bb0(%[[IN:.+]]: bf16, %[[OUT:.+]]: bf16):
96
+ // CHECK: linalg.yield %[[IN]] : bf16
97
+ %scale = tosa.const_shape { values = dense <[2 , 1 , 3 , 1 ]> : tensor <4 xindex > } : () -> !tosa.shape <4 >
98
+ %offset = tosa.const_shape { values = dense <0 > : tensor <2 xindex > } : () -> !tosa.shape <2 >
99
+ %border = tosa.const_shape { values = dense <0 > : tensor <2 xindex > } : () -> !tosa.shape <2 >
100
+ %resize = tosa.resize %arg0 , %scale , %offset , %border {mode = NEAREST_NEIGHBOR } : (tensor <3 x1 x1 x7 xbf16 >, !tosa.shape <4 >, !tosa.shape <2 >, !tosa.shape <2 >) -> tensor <3 x1 x5 x7 xbf16 >
101
+
102
+ return %resize : tensor <3 x1 x5 x7 xbf16 >
103
+ }
104
+
105
+ // -----
106
+
63
107
// CHECK-LABEL: @broadcast_resize_nearest_f32
64
108
func.func @broadcast_resize_nearest_f32 (%arg0 : tensor <3 x1 x1 x7 xf32 >) -> tensor <3 x1 x5 x7 xf32 > {
65
109
// CHECK: %[[COLLAPSE:.+]] = tensor.collapse_shape %arg0
0 commit comments