|
169 | 169 | lib.define(
|
170 | 170 | "quantized_conv_nhwc_dilated_asym8uxsym8u_asym8u.per_tensor_out(Tensor input, Tensor weight, Tensor bias, int[] stride, SymInt[] padding, int[] dilation, int groups, int input_zero_point, int weight_zero_point, float bias_scale, float out_scale, int out_zero_point, int out_multiplier, int out_shift, *, Tensor(a!) out) -> Tensor(a!)"
|
171 | 171 | )
|
| 172 | +lib.define( |
| 173 | + "quantized_conv1d_nchw_asym8sxsym8s_asym8s.per_tensor(Tensor input, Tensor weight, Tensor bias, int[] stride, SymInt[] padding, int[] dilation, int groups, int input_zero_point, int weight_zero_point, float bias_scale, float out_scale, int out_zero_point, int out_multiplier, int out_shift) -> (Tensor Z)" |
| 174 | +) |
| 175 | +lib.define( |
| 176 | + "quantized_conv1d_nchw_asym8sxsym8s_asym8s.per_tensor_out(Tensor input, Tensor weight, Tensor bias, int[] stride, SymInt[] padding, int[] dilation, int groups, int input_zero_point, int weight_zero_point, float bias_scale, float out_scale, int out_zero_point, int out_multiplier, int out_shift, *, Tensor(a!) out) -> Tensor(a!)" |
| 177 | +) |
| 178 | +lib.define( |
| 179 | + "quantized_conv1d_nchw_asym8uxsym8u_asym8u.per_tensor(Tensor input, Tensor weight, Tensor bias, int[] stride, SymInt[] padding, int[] dilation, int groups, int input_zero_point, int weight_zero_point, float bias_scale, float out_scale, int out_zero_point, int out_multiplier, int out_shift) -> (Tensor Z)" |
| 180 | +) |
| 181 | +lib.define( |
| 182 | + "quantized_conv1d_nchw_asym8uxsym8u_asym8u.per_tensor_out(Tensor input, Tensor weight, Tensor bias, int[] stride, SymInt[] padding, int[] dilation, int groups, int input_zero_point, int weight_zero_point, float bias_scale, float out_scale, int out_zero_point, int out_multiplier, int out_shift, *, Tensor(a!) out) -> Tensor(a!)" |
| 183 | +) |
| 184 | +lib.define( |
| 185 | + "quantized_conv1d_nhwc_asym8sxsym8s_asym8s.per_tensor(Tensor input, Tensor weight, Tensor bias, int[] stride, SymInt[] padding, int[] dilation, int groups, int input_zero_point, int weight_zero_point, float bias_scale, float out_scale, int out_zero_point, int out_multiplier, int out_shift) -> (Tensor Z)" |
| 186 | +) |
| 187 | +lib.define( |
| 188 | + "quantized_conv1d_nhwc_asym8sxsym8s_asym8s.per_tensor_out(Tensor input, Tensor weight, Tensor bias, int[] stride, SymInt[] padding, int[] dilation, int groups, int input_zero_point, int weight_zero_point, float bias_scale, float out_scale, int out_zero_point, int out_multiplier, int out_shift, *, Tensor(a!) out) -> Tensor(a!)" |
| 189 | +) |
| 190 | +lib.define( |
| 191 | + "quantized_conv1d_nhwc_asym8uxsym8u_asym8u.per_tensor(Tensor input, Tensor weight, Tensor bias, int[] stride, SymInt[] padding, int[] dilation, int groups, int input_zero_point, int weight_zero_point, float bias_scale, float out_scale, int out_zero_point, int out_multiplier, int out_shift) -> (Tensor Z)" |
| 192 | +) |
| 193 | +lib.define( |
| 194 | + "quantized_conv1d_nhwc_asym8uxsym8u_asym8u.per_tensor_out(Tensor input, Tensor weight, Tensor bias, int[] stride, SymInt[] padding, int[] dilation, int groups, int input_zero_point, int weight_zero_point, float bias_scale, float out_scale, int out_zero_point, int out_multiplier, int out_shift, *, Tensor(a!) out) -> Tensor(a!)" |
| 195 | +) |
172 | 196 | lib.define(
|
173 | 197 | "quantized_conv_nchw_depthwise_asym8sxsym8s_asym8s.per_tensor(Tensor input, Tensor weight, Tensor bias, int[] stride, SymInt[] padding, int[] dilation, int groups, int input_zero_point, int weight_zero_point, float bias_scale, float out_scale, int out_zero_point, int out_multiplier, int out_shift) -> (Tensor Z)"
|
174 | 198 | )
|
@@ -2153,6 +2177,150 @@ def roi_align_box_processor_meta(
|
2153 | 2177 | return rois.new_empty((rois.shape[0], 80), dtype=torch.uint8)
|
2154 | 2178 |
|
2155 | 2179 |
|
| 2180 | +@register_fake("cadence::quantized_conv1d_nchw_asym8sxsym8s_asym8s.per_tensor") |
| 2181 | +def quantized_conv1d_nchw_asym8sxsym8s_asym8s_per_tensor_meta( |
| 2182 | + input: torch.Tensor, |
| 2183 | + weight: torch.Tensor, |
| 2184 | + bias: torch.Tensor, |
| 2185 | + stride: Tuple[int], |
| 2186 | + padding: Tuple[int], |
| 2187 | + dilation: Tuple[int], |
| 2188 | + groups: int, |
| 2189 | + in_zero_point: int, |
| 2190 | + weight_zero_point: int, |
| 2191 | + bias_scale: float, |
| 2192 | + output_scale: float, |
| 2193 | + output_zero_point: int, |
| 2194 | + out_multiplier: int, |
| 2195 | + out_shift: int, |
| 2196 | +) -> torch.Tensor: |
| 2197 | + assert input.dim() == 3 and weight.dim() == 3 |
| 2198 | + assert ( |
| 2199 | + input.dtype == torch.int8 |
| 2200 | + and weight.dtype == torch.int8 |
| 2201 | + and bias.dtype == torch.int32 |
| 2202 | + ) |
| 2203 | + out_channels, _, kernel_size = weight.shape |
| 2204 | + output_size = get_conv1d_output_size( |
| 2205 | + input.shape, |
| 2206 | + out_channels, |
| 2207 | + stride[1], |
| 2208 | + padding[1], |
| 2209 | + dilation[1], |
| 2210 | + kernel_size, |
| 2211 | + False, |
| 2212 | + ) |
| 2213 | + return input.new_empty(output_size, dtype=input.dtype) |
| 2214 | + |
| 2215 | + |
| 2216 | +@register_fake("cadence::quantized_conv1d_nchw_asym8uxsym8u_asym8u.per_tensor") |
| 2217 | +def quantized_conv1d_nchw_asym8uxsym8u_asym8u_per_tensor_meta( |
| 2218 | + input: torch.Tensor, |
| 2219 | + weight: torch.Tensor, |
| 2220 | + bias: torch.Tensor, |
| 2221 | + stride: Tuple[int], |
| 2222 | + padding: Tuple[int], |
| 2223 | + dilation: Tuple[int], |
| 2224 | + groups: int, |
| 2225 | + in_zero_point: int, |
| 2226 | + weight_zero_point: int, |
| 2227 | + bias_scale: float, |
| 2228 | + output_scale: float, |
| 2229 | + output_zero_point: int, |
| 2230 | + out_multiplier: int, |
| 2231 | + out_shift: int, |
| 2232 | +) -> torch.Tensor: |
| 2233 | + assert input.dim() == 3 and weight.dim() == 3 |
| 2234 | + assert ( |
| 2235 | + input.dtype == torch.uint8 |
| 2236 | + and weight.dtype == torch.uint8 |
| 2237 | + and bias.dtype == torch.int32 |
| 2238 | + ) |
| 2239 | + out_channels, _, kernel_size = weight.shape |
| 2240 | + output_size = get_conv1d_output_size( |
| 2241 | + input.shape, |
| 2242 | + out_channels, |
| 2243 | + stride[1], |
| 2244 | + padding[1], |
| 2245 | + dilation[1], |
| 2246 | + kernel_size, |
| 2247 | + False, |
| 2248 | + ) |
| 2249 | + return input.new_empty(output_size, dtype=input.dtype) |
| 2250 | + |
| 2251 | + |
| 2252 | +@register_fake("cadence::quantized_conv1d_nhwc_asym8sxsym8s_asym8s.per_tensor") |
| 2253 | +def quantized_conv1d_nhwc_asym8sxsym8s_asym8s_per_tensor_meta( |
| 2254 | + input: torch.Tensor, |
| 2255 | + weight: torch.Tensor, |
| 2256 | + bias: torch.Tensor, |
| 2257 | + stride: Tuple[int], |
| 2258 | + padding: Tuple[int], |
| 2259 | + dilation: Tuple[int], |
| 2260 | + groups: int, |
| 2261 | + in_zero_point: int, |
| 2262 | + weight_zero_point: int, |
| 2263 | + bias_scale: float, |
| 2264 | + output_scale: float, |
| 2265 | + output_zero_point: int, |
| 2266 | + out_multiplier: int, |
| 2267 | + out_shift: int, |
| 2268 | +) -> torch.Tensor: |
| 2269 | + assert input.dim() == 3 and weight.dim() == 3 |
| 2270 | + assert ( |
| 2271 | + input.dtype == torch.int8 |
| 2272 | + and weight.dtype == torch.int8 |
| 2273 | + and bias.dtype == torch.int32 |
| 2274 | + ) |
| 2275 | + out_channels, kernel_size, _ = weight.shape |
| 2276 | + output_size = get_conv1d_output_size( |
| 2277 | + input.shape, |
| 2278 | + out_channels, |
| 2279 | + stride[1], |
| 2280 | + padding[1], |
| 2281 | + dilation[1], |
| 2282 | + kernel_size, |
| 2283 | + True, |
| 2284 | + ) |
| 2285 | + return input.new_empty(output_size, dtype=input.dtype) |
| 2286 | + |
| 2287 | + |
| 2288 | +@register_fake("cadence::quantized_conv1d_nhwc_asym8uxsym8u_asym8u.per_tensor") |
| 2289 | +def quantized_conv1d_nhwc_asym8uxsym8u_asym8u_per_tensor_meta( |
| 2290 | + input: torch.Tensor, |
| 2291 | + weight: torch.Tensor, |
| 2292 | + bias: torch.Tensor, |
| 2293 | + stride: Tuple[int], |
| 2294 | + padding: Tuple[int], |
| 2295 | + dilation: Tuple[int], |
| 2296 | + groups: int, |
| 2297 | + in_zero_point: int, |
| 2298 | + weight_zero_point: int, |
| 2299 | + bias_scale: float, |
| 2300 | + output_scale: float, |
| 2301 | + output_zero_point: int, |
| 2302 | + out_multiplier: int, |
| 2303 | + out_shift: int, |
| 2304 | +) -> torch.Tensor: |
| 2305 | + assert input.dim() == 3 and weight.dim() == 3 |
| 2306 | + assert ( |
| 2307 | + input.dtype == torch.uint8 |
| 2308 | + and weight.dtype == torch.uint8 |
| 2309 | + and bias.dtype == torch.int32 |
| 2310 | + ) |
| 2311 | + out_channels, kernel_size, _ = weight.shape |
| 2312 | + output_size = get_conv1d_output_size( |
| 2313 | + input.shape, |
| 2314 | + out_channels, |
| 2315 | + stride[1], |
| 2316 | + padding[1], |
| 2317 | + dilation[1], |
| 2318 | + kernel_size, |
| 2319 | + True, |
| 2320 | + ) |
| 2321 | + return input.new_empty(output_size, dtype=input.dtype) |
| 2322 | + |
| 2323 | + |
2156 | 2324 | @register_fake("cadence::_softmax_f32_f32")
|
2157 | 2325 | def softmax_f32_f32_meta(
|
2158 | 2326 | self: torch.Tensor,
|
|
0 commit comments