File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
backends/xnnpack/quantizer Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 4242 "propagate_annotation" ,
4343]
4444
45+ from pytorch .ao .test .dtypes .test_bitpacking import dimensions
46+
4547
4648# In the absence of better name, just winging it with QuantizationConfig
4749@dataclass (eq = True , frozen = True )
@@ -323,6 +325,17 @@ def _do_annotate_conv(
323325 assert isinstance (weight , Node )
324326 input_qspec_map [weight ] = get_weight_qspec (quantization_config )
325327
328+ # Only annotate dynamically quantized conv if it's 2D
329+ if (
330+ quantization_config
331+ and quantization_config .input_activation
332+ and quantization_config .input_activation .is_dynamic
333+ ):
334+ weight_val = weight .meta .get ("val" , None )
335+ weight_shape = getattr (weight_val , "shape" , None )
336+ if weight_shape is not None and len (weight_shape ) != 4 :
337+ continue
338+
326339 # adding weight node to the partition as well
327340 partition = [conv_node , conv_node .args [1 ]]
328341
You can’t perform that action at this time.
0 commit comments