604 lines · plain
1// RUN: mlir-opt --split-input-file -pass-pipeline="builtin.module(func.func(tosa-to-linalg))" %s -o -| FileCheck %s2 3// CHECK-LABEL: @unary_resize_nearest_fp324func.func @unary_resize_nearest_fp32(%arg0 : tensor<3x1x1x7xf32>) -> tensor<3x1x1x7xf32> {5 %scale = tosa.const_shape { values = dense<[2, 2, 1, 1]> : tensor<4xindex> } : () -> !tosa.shape<4>6 %offset = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>7 %border = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>8 %resize = tosa.resize %arg0, %scale, %offset, %border {mode = NEAREST_NEIGHBOR} : (tensor<3x1x1x7xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<3x1x1x7xf32>9 // CHECK: return %arg010 return %resize : tensor<3x1x1x7xf32>11}12 13// -----14 15// CHECK-LABEL: @unary_resize_nearest_bf1616func.func @unary_resize_nearest_bf16(%arg0 : tensor<3x1x1x7xbf16>) -> tensor<3x1x1x7xbf16> {17 %scale = tosa.const_shape { values = dense<[2, 2, 1, 1]> : tensor<4xindex> } : () -> !tosa.shape<4>18 %offset = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>19 %border = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>20 %resize = tosa.resize %arg0, %scale, %offset, %border {mode = NEAREST_NEIGHBOR} : (tensor<3x1x1x7xbf16>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<3x1x1x7xbf16>21 // CHECK: return %arg022 return %resize : tensor<3x1x1x7xbf16>23}24 25// -----26 27// CHECK-LABEL: @unary_resize_nearest_fp1628func.func @unary_resize_nearest_fp16(%arg0 : tensor<3x1x1x7xf16>) -> tensor<3x1x1x7xf16> {29 %scale = tosa.const_shape { values = dense<[2, 2, 1, 1]> : tensor<4xindex> } : () -> !tosa.shape<4>30 %offset = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>31 %border = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>32 %resize = tosa.resize %arg0, %scale, %offset, %border {mode = NEAREST_NEIGHBOR} : (tensor<3x1x1x7xf16>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<3x1x1x7xf16>33 // CHECK: return %arg034 return %resize : tensor<3x1x1x7xf16>35}36 37// -----38 39// CHECK-LABEL: @unary_resize_bilinear_fp3240func.func @unary_resize_bilinear_fp32(%arg0 : tensor<3x1x1x7xf32>) -> tensor<3x1x1x7xf32> {41 %scale = tosa.const_shape { values = dense<[2, 2, 1, 1]> : tensor<4xindex> } : () -> !tosa.shape<4>42 %offset = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>43 %border = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>44 %resize = tosa.resize %arg0, %scale, %offset, %border {mode = BILINEAR} : (tensor<3x1x1x7xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<3x1x1x7xf32>45 // CHECK: return %arg046 return %resize : tensor<3x1x1x7xf32>47}48 49// -----50 51// CHECK-LABEL: @unary_resize_bilinear_bf1652func.func @unary_resize_bilinear_bf16(%arg0 : tensor<3x1x1x7xbf16>) -> tensor<3x1x1x7xbf16> {53 %scale = tosa.const_shape { values = dense<[2, 2, 1, 1]> : tensor<4xindex> } : () -> !tosa.shape<4>54 %offset = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>55 %border = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>56 %resize = tosa.resize %arg0, %scale, %offset, %border {mode = BILINEAR} : (tensor<3x1x1x7xbf16>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<3x1x1x7xbf16>57 // CHECK: return %arg058 return %resize : tensor<3x1x1x7xbf16>59}60 61// -----62 63// CHECK-LABEL: @unary_resize_bilinear_fp1664func.func @unary_resize_bilinear_fp16(%arg0 : tensor<3x1x1x7xf16>) -> tensor<3x1x1x7xf16> {65 %scale = tosa.const_shape { values = dense<[2, 2, 1, 1]> : tensor<4xindex> } : () -> !tosa.shape<4>66 %offset = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>67 %border = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>68 %resize = tosa.resize %arg0, %scale, %offset, %border {mode = BILINEAR} : (tensor<3x1x1x7xf16>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<3x1x1x7xf16>69 // CHECK: return %arg070 return %resize : tensor<3x1x1x7xf16>71}72 73// -----74 75// CHECK-LABEL: @unary_resize_nearest_i876func.func @unary_resize_nearest_i8(%arg0 : tensor<3x1x1x7xi8>) -> tensor<3x1x1x7xi8> {77 %scale = tosa.const_shape { values = dense<[2, 1, 3, 1]> : tensor<4xindex> } : () -> !tosa.shape<4>78 %offset = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>79 %border = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>80 %resize = tosa.resize %arg0, %scale, %offset, %border {mode = NEAREST_NEIGHBOR} : (tensor<3x1x1x7xi8>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<3x1x1x7xi8>81 // CHECK: return %arg082 return %resize : tensor<3x1x1x7xi8>83}84 85// -----86 87// CHECK-LABEL: @broadcast_resize_nearest_bf1688func.func @broadcast_resize_nearest_bf16(%arg0 : tensor<3x1x1x7xbf16>) -> tensor<3x1x5x7xbf16> {89 // CHECK: %[[COLLAPSE:.+]] = tensor.collapse_shape %arg090 // CHECK-NEXT{literal}: [[0], [1, 2, 3]] : tensor<3x1x1x7xbf16> into tensor<3x7xbf16>91 // CHECK: %[[EMPTY:.+]] = tensor.empty() : tensor<3x1x5x7xbf16>92 // CHECK: %[[GENERIC:.+]] = linalg.generic93 // 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]] : bf1697 %scale = tosa.const_shape { values = dense<[2, 1, 3, 1]> : tensor<4xindex> } : () -> !tosa.shape<4>98 %offset = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>99 %border = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>100 %resize = tosa.resize %arg0, %scale, %offset, %border {mode = NEAREST_NEIGHBOR} : (tensor<3x1x1x7xbf16>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<3x1x5x7xbf16>101 102 return %resize : tensor<3x1x5x7xbf16>103}104 105// -----106 107// CHECK-LABEL: @broadcast_resize_nearest_f32108func.func @broadcast_resize_nearest_f32(%arg0 : tensor<3x1x1x7xf32>) -> tensor<3x1x5x7xf32> {109 // CHECK: %[[COLLAPSE:.+]] = tensor.collapse_shape %arg0110 // CHECK-NEXT{literal}: [[0], [1, 2, 3]] : tensor<3x1x1x7xf32> into tensor<3x7xf32>111 // CHECK: %[[EMPTY:.+]] = tensor.empty() : tensor<3x1x5x7xf32>112 // CHECK: %[[GENERIC:.+]] = linalg.generic113 // CHECK-SAME: indexing_maps = [#map, #map1], iterator_types = ["parallel", "parallel", "parallel", "parallel"]}114 // CHECK-SAME: ins(%[[COLLAPSE]] : tensor<3x7xf32>) outs(%[[EMPTY]] : tensor<3x1x5x7xf32>)115 // CHECK: ^bb0(%[[IN:.+]]: f32, %[[OUT:.+]]: f32):116 // CHECK: linalg.yield %[[IN]] : f32117 %scale = tosa.const_shape { values = dense<[2, 1, 3, 1]> : tensor<4xindex> } : () -> !tosa.shape<4>118 %offset = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>119 %border = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>120 %resize = tosa.resize %arg0, %scale, %offset, %border {mode = NEAREST_NEIGHBOR} : (tensor<3x1x1x7xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<3x1x5x7xf32>121 122 return %resize : tensor<3x1x5x7xf32>123}124 125// -----126 127// CHECK-LABEL: @broadcast_resize_bilinear_i8128func.func @broadcast_resize_bilinear_i8(%arg0 : tensor<3x1x1x7xi8>) -> tensor<3x4x5x7xi32> {129 // CHECK: %[[COLLAPSE:.+]] = tensor.collapse_shape %arg0130 // CHECK-SAME{literal}: [[0], [1, 2, 3]] : tensor<3x1x1x7xi8> into tensor<3x7xi8>131 // CHECK: %[[EMPTY:.+]] = tensor.empty() : tensor<3x7xi32>132 // CHECK: %[[RESIZE:.+]] = linalg.generic133 // CHECK-SAME: {indexing_maps = [#map, #map], iterator_types = ["parallel", "parallel"]}134 // CHECK-SAME: ins(%[[COLLAPSE]] : tensor<3x7xi8>) outs(%[[EMPTY]] : tensor<3x7xi32>)135 // CHECK: ^bb0(%[[IN:.+]]: i8, %[[OUT:.+]]: i32):136 // CHECK: %[[EXT:.+]] = arith.extsi %[[IN]] : i8 to i32137 // CHECK-DAG: %[[C2:.+]] = arith.constant 2 : i32138 // CHECK: %[[MUL:.+]] = arith.muli %[[EXT]], %[[C2]] : i32139 // CHECK-DAG: %[[C3:.+]] = arith.constant 3 : i32140 // CHECK: %[[OUT:.+]] = arith.muli %[[MUL]], %[[C3]] : i32141 // CHECK: linalg.yield %[[OUT]] : i32142 // CHECK: } -> tensor<3x7xi32>143 // CHECK: %[[EXPAND:.+]] = tensor.expand_shape %[[RESIZE]]144 // CHECK-SAME{literal}: [[0], [1, 2, 3]] output_shape [3, 1, 1, 7] :145 // CHECK-SAME: tensor<3x7xi32> into tensor<3x1x1x7xi32>146 // CHECK: %[[COLLAPSE_0:.+]] = tensor.collapse_shape %[[EXPAND]]147 // CHECK-SAME{literal}:[[0], [1, 2, 3]] : tensor<3x1x1x7xi32> into tensor<3x7xi32>148 // CHECK: %[[EMPTY_0:.+]] = tensor.empty() : tensor<3x4x5x7xi32>149 // CHECK: %[[BROADCAST:.+]] = linalg.generic150 // CHECK-SAME: indexing_maps = [#map1, #map2], iterator_types = ["parallel", "parallel", "parallel", "parallel"]}151 // CHECK-SAME: ins(%[[COLLAPSE_0]] : tensor<3x7xi32>) outs(%[[EMPTY_0]] : tensor<3x4x5x7xi32>) {152 // CHECK: ^bb0(%[[IN:.+]]: i32, %[[OUT:.+]]: i32):153 // CHECK: linalg.yield %[[IN]] : i32154 %scale = tosa.const_shape { values = dense<[2, 1, 3, 1]> : tensor<4xindex> } : () -> !tosa.shape<4>155 %offset = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>156 %border = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>157 %resize = tosa.resize %arg0, %scale, %offset, %border {mode = BILINEAR} : (tensor<3x1x1x7xi8>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<3x4x5x7xi32>158 159 return %resize : tensor<3x4x5x7xi32>160}161 162// -----163 164// CHECK-LABEL: @unary_resize_bilinear_i32165func.func @unary_resize_bilinear_i32(%arg0 : tensor<3x1x1x7xi8>) -> tensor<3x1x1x7xi32> {166 // CHECK: %[[COLLAPSE:.+]] = tensor.collapse_shape %arg0167 // CHECK-SAME{literal}: [[0], [1, 2, 3]] : tensor<3x1x1x7xi8> into tensor<3x7xi8>168 // CHECK: %[[EMPTY:.+]] = tensor.empty() : tensor<3x7xi32>169 // CHECK: %[[GENERIC:.+]] = linalg.generic170 // CHECK-SAME: indexing_maps = [#map, #map]171 // CHECK-SAME: iterator_types = ["parallel", "parallel"]}172 // CHECK-SAME: ins(%[[COLLAPSE]] : tensor<3x7xi8>) outs(%[[EMPTY]] : tensor<3x7xi32>) {173 // CHECK: ^bb0(%[[IN:.+]]: i8, %[[OUT:.+]]: i32):174 // CHECK: %[[EXT:.+]] = arith.extsi %[[IN]] : i8 to i32175 // CHECK-DAG: %[[C2:.+]] = arith.constant 2 : i32176 // CHECK: %[[MUL0:.+]] = arith.muli %[[EXT]], %[[C2]] : i32177 // CHECK-DAG: %[[C1:.+]] = arith.constant 2 : i32178 // CHECK: %7 = arith.muli %6, %[[C1]] : i32179 // CHECK: linalg.yield %7 : i32180 // CHECK: } -> tensor<3x7xi32>181 // CHECK: %[[EXPAND:.+]] = tensor.expand_shape %[[GENERIC:.+]]182 // CHECK-SAME{literal} [[0], [1, 2, 3]] : tensor<3x7xi32> into tensor<3x1x1x7xi32>183 %scale = tosa.const_shape { values = dense<[2, 1, 2, 1]> : tensor<4xindex> } : () -> !tosa.shape<4>184 %offset = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>185 %border = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>186 %resize = tosa.resize %arg0, %scale, %offset, %border {mode = BILINEAR} : (tensor<3x1x1x7xi8>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<3x1x1x7xi32>187 188 // CHECK: return %[[EXPAND]]189 return %resize : tensor<3x1x1x7xi32>190}191 192// -----193 194// CHECK-LABEL: @resize_nearest_int195func.func @resize_nearest_int(%arg0: tensor<1x15x13x1xi8>) -> () {196 // CHECK: %[[INIT:.+]] = tensor.empty() : tensor<1x23x179x1xi8>197 // CHECK: %[[GENERIC:.+]] = linalg.generic198 // CHECK: %[[IDX_0:.+]] = linalg.index 0199 // CHECK: %[[IDX_1:.+]] = linalg.index 1200 // CHECK: %[[IDX_2:.+]] = linalg.index 2201 // CHECK: %[[IDX_3:.+]] = linalg.index 3202 // CHECK-DAG: %[[ZERO:.+]] = arith.constant 0203 // CHECK-DAG: %[[Y_MAX:.+]] = arith.constant 14204 // CHECK-DAG: %[[X_MAX:.+]] = arith.constant 12205 206 // CHECK: %[[Y:.+]] = arith.index_cast %[[IDX_1]]207 // CHECK: %[[X:.+]] = arith.index_cast %[[IDX_2]]208 // CHECK-DAG: %[[SCALE_Y_N:.*]] = arith.constant 11209 // CHECK-DAG: %[[SCALE_Y_D:.*]] = arith.constant 7210 // CHECK-DAG: %[[SCALE_X_N:.*]] = arith.constant 89211 // CHECK-DAG: %[[SCALE_X_D:.*]] = arith.constant 6212 // CHECK-DAG: %[[OFFSET_Y:.*]] = arith.constant 0213 // CHECK-DAG: %[[OFFSET_X:.*]] = arith.constant 0214 // CHECK-DAG: %[[BORDER_Y:.*]] = arith.constant 0215 // CHECK-DAG: %[[BORDER_X:.*]] = arith.constant 0216 217 // find the remainder and integer component of the target index.218 219 // CHECK: %[[TEMP_Y:.*]] = arith.muli %[[Y]], %[[SCALE_Y_D]]220 // CHECK: %[[Y:.*]] = arith.addi %[[TEMP_Y]], %[[OFFSET_Y]]221 // CHECK: %[[I_Y:.*]] = arith.divsi %[[Y]], %[[SCALE_Y_N]]222 // CHECK: %[[TEMP_Y:.*]] = arith.muli %[[I_Y]], %[[SCALE_Y_N]]223 // CHECK: %[[D_Y:.*]] = arith.subi %[[Y]], %[[TEMP_Y]]224 225 // CHECK: %[[TEMP_X:.*]] = arith.muli %[[X]], %[[SCALE_X_D]]226 // CHECK: %[[X:.*]] = arith.addi %[[TEMP_X]], %[[OFFSET_X]]227 // CHECK: %[[I_X:.*]] = arith.divsi %[[X]], %[[SCALE_X_N]]228 // CHECK: %[[TEMP_X:.*]] = arith.muli %[[I_X]], %[[SCALE_X_N]]229 // CHECK: %[[D_X:.*]] = arith.subi %[[X]], %[[TEMP_X]]230 231 // Compute the offset and bound for the Y position.232 // CHECK-DAG: %[[ONE:.*]] = arith.constant 1233 // CHECK: %[[D_Y_DOUBLE:.*]] = arith.shli %[[D_Y]], %[[ONE]]234 // CHECK: %[[PRED_Y:.*]] = arith.cmpi sge, %[[D_Y_DOUBLE]], %[[SCALE_Y_N]]235 // CHECK: %[[VAL_37:.*]] = arith.select %[[PRED_Y]], %[[ONE]], %[[ZERO]]236 // CHECK: %[[VAL_39:.*]] = arith.addi %[[I_Y]], %[[VAL_37]]237 // CHECK: %[[LOWER:.*]] = arith.maxsi %[[ZERO]], %[[VAL_39]]238 // CHECK: %[[CLAMPED:.*]] = arith.minsi %[[Y_MAX]], %[[LOWER]]239 // CHECK: %[[IDY:.+]] = arith.index_cast %[[CLAMPED]]240 241 // Compute the offset and bound for the X position.242 // CHECK: %[[D_X_DOUBLE:.*]] = arith.shli %[[D_X]], %[[ONE]]243 // CHECK: %[[PRED_X:.*]] = arith.cmpi sge, %[[D_X_DOUBLE]], %[[SCALE_X_N]]244 // CHECK: %[[VAL_38:.*]] = arith.select %[[PRED_X]], %[[ONE]], %[[ZERO]]245 // CHECK: %[[VAL_40:.*]] = arith.addi %[[I_X]], %[[VAL_38]]246 // CHECK: %[[LOWER:.*]] = arith.maxsi %[[ZERO]], %[[VAL_40]]247 // CHECK: %[[CLAMPED:.*]] = arith.minsi %[[X_MAX]], %[[LOWER]]248 // CHECK: %[[IDX:.+]] = arith.index_cast %[[CLAMPED]]249 250 // CHECK: %[[EXTRACT:.+]] = tensor.extract %arg0[%[[IDX_0]], %[[IDY]], %[[IDX]], %[[IDX_3]]]251 // CHECK: linalg.yield %[[EXTRACT]]252 253 // Round to the nearest index.254 %scale = tosa.const_shape { values = dense<[11, 7, 89, 6]> : tensor<4xindex> } : () -> !tosa.shape<4>255 %offset = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>256 %border = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>257 %0 = tosa.resize %arg0, %scale, %offset, %border {mode = NEAREST_NEIGHBOR} : (tensor<1x15x13x1xi8>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x23x179x1xi8>258 return259}260 261// -----262 263// CHECK-LABEL: @resize_bilinear_int264// CHECK-SAME: (%[[ARG0:[0-9a-zA-Z_]*]]:265func.func @resize_bilinear_int(%arg0: tensor<1x19x20x1xi8>) {266 // CHECK: %[[INIT:.+]] = tensor.empty() : tensor<1x289x305x1xi48>267 // CHECK: %[[GENERIC:.+]] = linalg.generic268 // CHECK: %[[IDX_0:.+]] = linalg.index 0269 // CHECK: %[[IDX_1:.+]] = linalg.index 1270 // CHECK: %[[IDX_2:.+]] = linalg.index 2271 // CHECK: %[[IDX_3:.+]] = linalg.index 3272 // CHECK-DAG: %[[ZERO:.+]] = arith.constant 0273 // CHECK-DAG: %[[Y_MAX:.+]] = arith.constant 18274 // CHECK-DAG: %[[X_MAX:.+]] = arith.constant 19275 // CHECK: %[[Y:.+]] = arith.index_cast %[[IDX_1]]276 // CHECK: %[[X:.+]] = arith.index_cast %[[IDX_2]]277 // CHECK-DAG: %[[SCALE_Y_N:.*]] = arith.constant 16278 // CHECK-DAG: %[[SCALE_Y_D:.*]] = arith.constant 1279 // CHECK-DAG: %[[SCALE_X_N:.*]] = arith.constant 16280 // CHECK-DAG: %[[SCALE_X_D:.*]] = arith.constant 1281 // CHECK-DAG: %[[OFFSET_Y:.*]] = arith.constant 0282 // CHECK-DAG: %[[OFFSET_X:.*]] = arith.constant 0283 // CHECK-DAG: %[[BORDER_Y:.*]] = arith.constant 0284 // CHECK-DAG: %[[BORDER_X:.*]] = arith.constant 0285 286 // CHECK: %[[TEMP_Y:.*]] = arith.muli %[[Y]], %[[SCALE_Y_D]]287 // CHECK: %[[Y:.*]] = arith.addi %[[TEMP_Y]], %[[OFFSET_Y]]288 // CHECK: %[[I_Y:.*]] = arith.divsi %[[Y]], %[[SCALE_Y_N]]289 // CHECK: %[[TEMP_Y:.*]] = arith.muli %[[I_Y]], %[[SCALE_Y_N]]290 // CHECK: %[[D_Y:.*]] = arith.subi %[[Y]], %[[TEMP_Y]]291 292 // CHECK: %[[TEMP_X:.*]] = arith.muli %[[X]], %[[SCALE_X_D]]293 // CHECK: %[[X:.*]] = arith.addi %[[TEMP_X]], %[[OFFSET_X]]294 // CHECK: %[[I_X:.*]] = arith.divsi %[[X]], %[[SCALE_X_N]]295 // CHECK: %[[TEMP_X:.*]] = arith.muli %[[I_X]], %[[SCALE_X_N]]296 // CHECK: %[[D_X:.*]] = arith.subi %[[X]], %[[TEMP_X]]297 298 // Compute the left, right, and top indices for the bilinear interpolation.299 300 // CHECK-DAG: %[[ONE:.*]] = arith.constant 1301 // CHECK: %[[Y1:.*]] = arith.addi %[[I_Y]], %[[ONE]]302 303 // Bound check each dimension.304 305 // CHECK: %[[BOUND:.*]] = arith.maxsi %[[ZERO]], %[[I_Y]]306 // CHECK: %[[YLO:.*]] = arith.minsi %[[Y_MAX]], %[[BOUND]]307 308 // CHECK: %[[BOUND:.*]] = arith.maxsi %[[ZERO]], %[[Y1]]309 // CHECK: %[[YHI:.*]] = arith.minsi %[[Y_MAX]], %[[BOUND]]310 311 // CHECK: %[[YLOI:.+]] = arith.index_cast %[[YLO]]312 // CHECK: %[[YHII:.+]] = arith.index_cast %[[YHI]]313 314 // CHECK: %[[X1:.*]] = arith.addi %[[I_X]], %[[ONE]]315 // CHECK: %[[BOUND:.*]] = arith.maxsi %[[ZERO]], %[[I_X]]316 // CHECK: %[[XLO:.*]] = arith.minsi %[[X_MAX]], %[[BOUND]]317 318 // CHECK: %[[BOUND:.*]] = arith.maxsi %[[ZERO]], %[[X1]]319 // CHECK: %[[XHI:.*]] = arith.minsi %[[X_MAX]], %[[BOUND]]320 321 // CHECK: %[[XLOI:.+]] = arith.index_cast %[[XLO]]322 // CHECK: %[[XHII:.+]] = arith.index_cast %[[XHI]]323 324 // Extract each corner of the bilinear interpolation.325 326 // CHECK: %[[LOLO:.+]] = tensor.extract %[[ARG0]][%[[IDX_0]], %[[YLOI]], %[[XLOI]], %[[IDX_3]]]327 // CHECK: %[[LOHI:.+]] = tensor.extract %[[ARG0]][%[[IDX_0]], %[[YLOI]], %[[XHII]], %[[IDX_3]]]328 // CHECK: %[[HILO:.+]] = tensor.extract %[[ARG0]][%[[IDX_0]], %[[YHII]], %[[XLOI]], %[[IDX_3]]]329 // CHECK: %[[HIHI:.+]] = tensor.extract %[[ARG0]][%[[IDX_0]], %[[YHII]], %[[XHII]], %[[IDX_3]]]330 331 // CHECK: %[[XLOLO:.+]] = arith.extsi %[[LOLO]]332 // CHECK: %[[XLOHI:.+]] = arith.extsi %[[LOHI]]333 // CHECK: %[[XHILO:.+]] = arith.extsi %[[HILO]]334 // CHECK: %[[XHIHI:.+]] = arith.extsi %[[HIHI]]335 336 // CHECK-NEXT: %[[D_X_EXT:.+]] = arith.extsi %[[D_X]]337 // CHECK-NEXT: %[[D_Y_EXT:.+]] = arith.extsi %[[D_Y]]338 // CHECK-NEXT: %[[Y_N_EXT:.+]] = arith.extsi %[[SCALE_Y_N]]339 // CHECK-NEXT: %[[X_N_EXT:.+]] = arith.extsi %[[SCALE_X_N]]340 341 // Compute the bilinear interpolation.342 343 // CHECK: %[[NDX:.+]] = arith.subi %[[X_N_EXT]], %[[D_X_EXT]]344 // CHECK: %[[WLOLO:.+]] = arith.muli %[[XLOLO]], %[[NDX]]345 // CHECK: %[[WLOHI:.+]] = arith.muli %[[XLOHI]], %[[D_X_EXT]]346 // CHECK: %[[LO:.+]] = arith.addi %[[WLOLO]], %[[WLOHI]]347 // CHECK: %[[NDX:.+]] = arith.subi %[[X_N_EXT]], %[[D_X_EXT]]348 // CHECK: %[[WHILO:.+]] = arith.muli %[[XHILO]], %[[NDX]]349 // CHECK: %[[WHIHI:.+]] = arith.muli %[[XHIHI]], %[[D_X_EXT]]350 // CHECK: %[[HI:.+]] = arith.addi %[[WHILO]], %[[WHIHI]]351 // CHECK: %[[NDY:.+]] = arith.subi %[[Y_N_EXT]], %[[D_Y_EXT]]352 // CHECK: %[[WLO:.+]] = arith.muli %[[LO]], %[[NDY]]353 // CHECK: %[[WHI:.+]] = arith.muli %[[HI]], %[[D_Y_EXT]]354 // CHECK: %[[RESULT:.+]] = arith.addi %[[WLO]], %[[WHI]]355 // CHECK: linalg.yield %[[RESULT]]356 357 // Round to the nearest index.358 %scale = tosa.const_shape { values = dense<[16, 1, 16, 1]> : tensor<4xindex> } : () -> !tosa.shape<4>359 %offset = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>360 %border = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>361 %0 = tosa.resize %arg0, %scale, %offset, %border {mode = BILINEAR} : (tensor<1x19x20x1xi8>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x289x305x1xi48>362 return363}364 365// -----366 367// CHECK-LABEL: @resize_nearest_fp32368func.func @resize_nearest_fp32(%input: tensor<1x50x48x1xf32>) -> () {369 // CHECK: %[[INIT:.+]] = tensor.empty() : tensor<1x1600x1536x1xf32>370 // CHECK: %[[GENERIC:.+]] = linalg.generic371 // CHECK: %[[IDX0:.+]] = linalg.index 0372 // CHECK: %[[IDX1:.+]] = linalg.index 1373 // CHECK: %[[IDX2:.+]] = linalg.index 2374 // CHECK: %[[IDX3:.+]] = linalg.index 3375 // CHECK-DAG: %[[ZERO:.*]] = arith.constant 0376 // CHECK-DAG: %[[YMAX:.*]] = arith.constant 49377 // CHECK-DAG: %[[XMAX:.*]] = arith.constant 47378 // CHECK: %[[Y:.+]] = arith.index_cast %[[IDX1]]379 // CHECK: %[[X:.+]] = arith.index_cast %[[IDX2]]380 // CHECK-DAG: %[[SCALE_Y_N:.*]] = arith.constant 64381 // CHECK-DAG: %[[SCALE_Y_D:.*]] = arith.constant 2382 // CHECK-DAG: %[[SCALE_X_N:.*]] = arith.constant 64383 // CHECK-DAG: %[[SCALE_X_D:.*]] = arith.constant 2384 // CHECK-DAG: %[[OFFSET_Y:.*]] = arith.constant -31385 // CHECK-DAG: %[[OFFSET_X:.*]] = arith.constant -31386 // CHECK-DAG: %[[BORDER_Y:.*]] = arith.constant 31387 // CHECK-DAG: %[[BORDER_X:.*]] = arith.constant 31388 389 // CHECK: %[[VAL_29:.*]] = arith.muli %[[Y]], %[[SCALE_Y_D]]390 // CHECK: %[[Y_TEMP:.*]] = arith.addi %[[VAL_29]], %[[OFFSET_Y]]391 // CHECK: %[[IY_TEMP:.*]] = arith.floordivsi %[[Y_TEMP]], %[[SCALE_Y_N]]392 // CHECK: %[[RY:.*]] = arith.remsi %[[Y_TEMP]], %[[SCALE_Y_N]]393 // CHECK: %[[RY_FP:.*]] = arith.sitofp %[[RY]]394 // CHECK: %[[SCALE_Y_N_FP:.*]] = arith.uitofp %[[SCALE_Y_N]]395 // CHECK: %[[D_Y:.*]] = arith.divf %[[RY_FP]], %[[SCALE_Y_N_FP]]396 397 // CHECK: %[[VAL_30:.*]] = arith.muli %[[X]], %[[SCALE_X_D]]398 // CHECK: %[[X_TEMP:.*]] = arith.addi %[[VAL_30]], %[[OFFSET_X]]399 // CHECK: %[[IX_TEMP:.*]] = arith.floordivsi %[[X_TEMP]], %[[SCALE_X_N]]400 // CHECK: %[[RX:.*]] = arith.remsi %[[X_TEMP]], %[[SCALE_X_N]]401 // CHECK: %[[RX_FP:.*]] = arith.sitofp %[[RX]]402 // CHECK: %[[SCALE_X_N_FP:.*]] = arith.uitofp %[[SCALE_X_N]]403 // CHECK: %[[D_X:.*]] = arith.divf %[[RX_FP]], %[[SCALE_X_N_FP]]404 405 // CHECK-DAG: %[[ONE:.*]] = arith.constant 1406 // CHECK-DAG: %[[HALF:.*]] = arith.constant 5.000000e-01407 // CHECK: %[[PRED_Y:.*]] = arith.cmpf oge, %[[D_Y]], %[[HALF]]408 // CHECK: %[[ROUND_Y:.*]] = arith.select %[[PRED_Y]], %[[ONE]], %[[ZERO]]409 // CHECK: %[[VAL_48:.*]] = arith.addi %[[IY_TEMP]], %[[ROUND_Y]]410 // CHECK: %[[LOWER:.*]] = arith.maxsi %[[ZERO]], %[[VAL_48]]411 // CHECK: %[[CLAMPED:.*]] = arith.minsi %[[YMAX]], %[[LOWER]]412 // CHECK: %[[IDY:.*]] = arith.index_cast %[[CLAMPED]]413 414 // CHECK-DAG: %[[HALF:.*]] = arith.constant 5.000000e-01415 // CHECK: %[[PRED_X:.*]] = arith.cmpf oge, %[[D_X]], %[[HALF]]416 // CHECK: %[[ROUND_X:.*]] = arith.select %[[PRED_X]], %[[ONE]], %[[ZERO]]417 // CHECK: %[[VAL_49:.*]] = arith.addi %[[IX_TEMP]], %[[ROUND_X]]418 // CHECK: %[[LOWER:.*]] = arith.maxsi %[[ZERO]], %[[VAL_49]]419 // CHECK: %[[CLAMPED:.*]] = arith.minsi %[[XMAX]], %[[LOWER]]420 // CHECK: %[[IDX:.*]] = arith.index_cast %[[CLAMPED]]421 422 // CHECK: %[[EXTRACT:.+]] = tensor.extract %arg0[%[[IDX0]], %[[IDY]], %[[IDX]], %[[IDX3]]]423 // CHECK: linalg.yield %[[EXTRACT]]424 425 %scale = tosa.const_shape { values = dense<[64, 2, 64, 2]> : tensor<4xindex> } : () -> !tosa.shape<4>426 %offset = tosa.const_shape { values = dense<[-31, -31]> : tensor<2xindex> } : () -> !tosa.shape<2>427 %border = tosa.const_shape { values = dense<[31, 31]> : tensor<2xindex> } : () -> !tosa.shape<2>428 %output = tosa.resize %input, %scale, %offset, %border {mode = NEAREST_NEIGHBOR} : (tensor<1x50x48x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x1600x1536x1xf32>429 return430}431 432// -----433 434// CHECK-LABEL: @resize_bilinear_fp435func.func @resize_bilinear_fp(%input: tensor<1x23x24x1xf32>) -> () {436 // CHECK: %[[INIT:.+]] = tensor.empty() : tensor<1x89x93x1xf32>437 // CHECK: %[[GENERIC:.+]] = linalg.generic438 // CHECK: %[[IDX_0:.+]] = linalg.index 0439 // CHECK: %[[IDX_1:.+]] = linalg.index 1440 // CHECK: %[[IDX_2:.+]] = linalg.index 2441 // CHECK: %[[IDX_3:.+]] = linalg.index 3442 // CHECK-DAG: %[[ZERO:.*]] = arith.constant 0443 // CHECK-DAG: %[[Y_MAX:.*]] = arith.constant 22444 // CHECK-DAG: %[[X_MAX:.*]] = arith.constant 23445 // CHECK: %[[Y:.+]] = arith.index_cast %[[IDX_1]]446 // CHECK: %[[X:.+]] = arith.index_cast %[[IDX_2]]447 // CHECK-DAG: %[[SCALE_Y_N:.*]] = arith.constant 4448 // CHECK-DAG: %[[SCALE_Y_D:.*]] = arith.constant 1449 // CHECK-DAG: %[[SCALE_X_N:.*]] = arith.constant 4450 // CHECK-DAG: %[[SCALE_X_D:.*]] = arith.constant 1451 // CHECK-DAG: %[[OFFSET_Y:.*]] = arith.constant 0452 // CHECK-DAG: %[[OFFSET_X:.*]] = arith.constant 0453 // CHECK-DAG: %[[BORDER_Y:.*]] = arith.constant 0454 // CHECK-DAG: %[[BORDER_X:.*]] = arith.constant 0455 456 // CHECK: %[[VAL_29:.*]] = arith.muli %[[Y]], %[[SCALE_Y_D]]457 // CHECK: %[[Y_TEMP:.*]] = arith.addi %[[VAL_29]], %[[OFFSET_Y]]458 // CHECK: %[[I_Y:.*]] = arith.floordivsi %[[Y_TEMP]], %[[SCALE_Y_N]]459 // CHECK: %[[RY:.*]] = arith.remsi %[[Y_TEMP]], %[[SCALE_Y_N]]460 // CHECK: %[[RY_FP:.*]] = arith.sitofp %[[RY]]461 // CHECK: %[[SCALE_Y_N_FP:.*]] = arith.uitofp %[[SCALE_Y_N]]462 // CHECK: %[[D_Y:.*]] = arith.divf %[[RY_FP]], %[[SCALE_Y_N_FP]]463 464 // CHECK: %[[VAL_30:.*]] = arith.muli %[[X]], %[[SCALE_X_D]]465 // CHECK: %[[X_TEMP:.*]] = arith.addi %[[VAL_30]], %[[OFFSET_X]]466 // CHECK: %[[I_X:.*]] = arith.floordivsi %[[X_TEMP]], %[[SCALE_X_N]]467 // CHECK: %[[RX:.*]] = arith.remsi %[[X_TEMP]], %[[SCALE_X_N]]468 // CHECK: %[[RX_FP:.*]] = arith.sitofp %[[RX]]469 // CHECK: %[[SCALE_X_N_FP:.*]] = arith.uitofp %[[SCALE_X_N]]470 // CHECK: %[[D_X:.*]] = arith.divf %[[RX_FP]], %[[SCALE_X_N_FP]]471 472 // Compute the left, right, and top indices for the bilinear interpolation.473 474 // CHECK: %[[ONE:.*]] = arith.constant 1475 476 // Bound check each dimension.477 478 // CHECK: %[[Y1:.*]] = arith.addi %[[I_Y]], %[[ONE]]479 480 // CHECK: %[[BOUND:.*]] = arith.maxsi %[[ZERO]], %[[I_Y]]481 // CHECK: %[[YLO:.*]] = arith.minsi %[[Y_MAX]], %[[BOUND]]482 483 // CHECK: %[[BOUND:.*]] = arith.maxsi %[[ZERO]], %[[Y1]]484 // CHECK: %[[YHI:.*]] = arith.minsi %[[Y_MAX]], %[[BOUND]]485 486 // CHECK: %[[YLOI:.+]] = arith.index_cast %[[YLO]]487 // CHECK: %[[YHII:.+]] = arith.index_cast %[[YHI]]488 489 // CHECK: %[[X1:.*]] = arith.addi %[[I_X]], %[[ONE]]490 // CHECK: %[[BOUND:.*]] = arith.maxsi %[[ZERO]], %[[I_X]]491 // CHECK: %[[XLO:.*]] = arith.minsi %[[X_MAX]], %[[BOUND]]492 493 // CHECK: %[[BOUND:.*]] = arith.maxsi %[[ZERO]], %[[X1]]494 // CHECK: %[[XHI:.*]] = arith.minsi %[[X_MAX]], %[[BOUND]]495 496 // CHECK: %[[XLOI:.+]] = arith.index_cast %[[XLO]]497 // CHECK: %[[XHII:.+]] = arith.index_cast %[[XHI]]498 499 // CHECK: %[[LOLO:.+]] = tensor.extract %arg0[%[[IDX_0]], %[[YLOI]], %[[XLOI]], %[[IDX_3]]]500 // CHECK: %[[LOHI:.+]] = tensor.extract %arg0[%[[IDX_0]], %[[YLOI]], %[[XHII]], %[[IDX_3]]]501 // CHECK: %[[HILO:.+]] = tensor.extract %arg0[%[[IDX_0]], %[[YHII]], %[[XLOI]], %[[IDX_3]]]502 // CHECK: %[[HIHI:.+]] = tensor.extract %arg0[%[[IDX_0]], %[[YHII]], %[[XHII]], %[[IDX_3]]]503 504 // CHECK-DAG: %[[ONE:.+]] = arith.constant 1.000000e+00 : f32505 // CHECK: %[[NDX:.+]] = arith.subf %[[ONE]], %[[D_X]]506 // CHECK: %[[WLOLO:.+]] = arith.mulf %[[LOLO]], %[[NDX]]507 // CHECK: %[[WLOHI:.+]] = arith.mulf %[[LOHI]], %[[D_X]]508 // CHECK: %[[LO:.+]] = arith.addf %[[WLOLO]], %[[WLOHI]]509 // CHECK: %[[NDX:.+]] = arith.subf %[[ONE]], %[[D_X]]510 // CHECK: %[[WHILO:.+]] = arith.mulf %[[HILO]], %[[NDX]]511 // CHECK: %[[WHIHI:.+]] = arith.mulf %[[HIHI]], %[[D_X]]512 // CHECK: %[[HI:.+]] = arith.addf %[[WHILO]], %[[WHIHI]]513 // CHECK: %[[NDY:.+]] = arith.subf %[[ONE]], %[[D_Y]]514 // CHECK: %[[WLO:.+]] = arith.mulf %[[LO]], %[[NDY]]515 // CHECK: %[[WHI:.+]] = arith.mulf %[[HI]], %[[D_Y]]516 // CHECK: %[[RESULT:.+]] = arith.addf %[[WLO]], %[[WHI]]517 // CHECK: linalg.yield %[[RESULT]]518 519 // Round by bilinear interpolation520 %scale = tosa.const_shape { values = dense<[4, 1, 4, 1]> : tensor<4xindex> } : () -> !tosa.shape<4>521 %offset = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>522 %border = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>523 %output = tosa.resize %input, %scale, %offset, %border {mode = BILINEAR} : (tensor<1x23x24x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x89x93x1xf32>524 525 return526}527 528// -----529 530// CHECK-LABEL: @resize_dyn531// CHECK-SAME: (%[[ARG0:[0-9a-zA-Z_]*]]:532func.func @resize_dyn(%input: tensor<?x2x2x1xi8>) -> () {533 // CHECK-DAG: %[[C0:.+]] = arith.constant 0534 // CHECK: %[[BATCH:.+]] = tensor.dim %arg0, %[[C0]]535 // CHECK: %[[INIT:.+]] = tensor.empty(%[[BATCH]]) : tensor<?x4x4x1xi32>536 // CHECK: %[[GENERIC:.+]] = linalg.generic537 %scale = tosa.const_shape { values = dense<[4, 2, 4, 2]> : tensor<4xindex> } : () -> !tosa.shape<4>538 %offset = tosa.const_shape { values = dense<[-1, -1]> : tensor<2xindex> } : () -> !tosa.shape<2>539 %border = tosa.const_shape { values = dense<[1, 1]> : tensor<2xindex> } : () -> !tosa.shape<2>540 %output = tosa.resize %input, %scale, %offset, %border { mode = BILINEAR } : (tensor<?x2x2x1xi8>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> (tensor<?x4x4x1xi32>)541 return542}543 544// -----545 546// CHECK-LABEL: @resize_bilinear_int48547func.func @resize_bilinear_int48(%arg0: tensor<1x19x19x1xi16>) {548 %scale = tosa.const_shape { values = dense<[16, 1, 16, 1]> : tensor<4xindex> } : () -> !tosa.shape<4>549 %offset = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>550 %border = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>551 %0 = tosa.resize %arg0, %scale, %offset, %border {mode = BILINEAR} : (tensor<1x19x19x1xi16>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x289x289x1xi48>552 return553}554 555// -----556 557// CHECK-LABEL: skip_interpolate_bilinear_i8558func.func @skip_interpolate_bilinear_i8(%arg0 : tensor<3x1x2x7xi8>) -> tensor<3x1x4x7xi32> {559 // CHECK: %[[GENERIC:.+]] = linalg.generic560 // CHECK: %[[BATCH:.+]] = linalg.index 0561 // CHECK: %[[CHANNEL:.+]] = linalg.index 3562 // CHECK-DAG: %[[C3:.+]] = arith.constant 3563 // CHECK-DAG: %[[C2:.+]] = arith.constant 2564 // CHECK: %[[EXTRACT0:.+]] = tensor.extract %arg0[%[[BATCH]], %{{.+}}, %{{.+}}, %[[CHANNEL]]] : tensor<3x1x2x7xi8>565 // CHECK: %[[EXTRACT1:.+]] = tensor.extract %arg0[%[[BATCH]], %{{.+}}, %{{.+}}, %[[CHANNEL]]] : tensor<3x1x2x7xi8>566 // CHECK: %[[EXT0:.+]] = arith.extsi %[[EXTRACT0]] : i8 to i32567 // CHECK: %[[EXT1:.+]] = arith.extsi %[[EXTRACT1]] : i8 to i32568 // CHECK: %[[SUB:.+]] = arith.subi %[[C3]], %[[DX:.+]]569 // CHECK: %[[MUL0:.+]] = arith.muli %[[EXT0]], %[[SUB]]570 // CHECK: %[[MUL1:.+]] = arith.muli %[[EXT1]], %[[DX]]571 // CHECK: %[[ADD:.+]] = arith.addi %[[MUL0]], %[[MUL1]]572 // CHECK: %[[RES:.+]] = arith.muli %[[ADD]], %[[C2]]573 // CHECK: linalg.yield %[[RES]]574 %scale = tosa.const_shape { values = dense<[2, 1, 3, 1]> : tensor<4xindex> } : () -> !tosa.shape<4>575 %offset = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>576 %border = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>577 %resize = tosa.resize %arg0, %scale, %offset, %border {mode = BILINEAR} : (tensor<3x1x2x7xi8>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<3x1x4x7xi32>578 579 // CHECK: return %[[GENERIC]]580 return %resize : tensor<3x1x4x7xi32>581}582 583// CHECK-LABEL: skip_interpolate_bilinear_f32584func.func @skip_interpolate_bilinear_f32(%arg0 : tensor<3x1x2x7xf32>) -> tensor<3x1x4x7xf32> {585 // CHECK: %[[GENERIC:.+]] = linalg.generic586 // CHECK: %[[BATCH:.+]] = linalg.index 0 : index587 // CHECK: %[[CHANNEL:.+]] = linalg.index 3 : index588 // CHECK: %[[EXTRACT0:.+]] = tensor.extract %arg0[%[[BATCH]], %{{.+}}, %{{.+}}, %[[CHANNEL]]] : tensor<3x1x2x7xf32>589 // CHECK: %[[EXTRACT1:.+]] = tensor.extract %arg0[%[[BATCH]], %{{.+}}, %{{.+}}, %[[CHANNEL]]] : tensor<3x1x2x7xf32>590 // CHECK: %[[C1:.+]] = arith.constant 1.000000e+00591 // CHECK: %[[SUB:.+]] = arith.subf %[[C1]], %[[DX:.+]]592 // CHECK: %[[MUL0:.+]] = arith.mulf %[[EXTRACT0]], %[[SUB]]593 // CHECK: %[[MUL1:.+]] = arith.mulf %[[EXTRACT1]], %[[DX]]594 // CHECK: %[[ADD:.+]] = arith.addf %[[MUL0]], %[[MUL1]]595 // CHECK: linalg.yield %[[ADD]]596 %scale = tosa.const_shape { values = dense<[2, 1, 3, 1]> : tensor<4xindex> } : () -> !tosa.shape<4>597 %offset = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>598 %border = tosa.const_shape { values = dense<0> : tensor<2xindex> } : () -> !tosa.shape<2>599 %resize = tosa.resize %arg0, %scale, %offset, %border {mode = BILINEAR} : (tensor<3x1x2x7xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<3x1x4x7xf32>600 601 // CHECK: return %[[GENERIC]]602 return %resize : tensor<3x1x4x7xf32>603}604