@@ -333,41 +333,67 @@ def __init__(
333333 self .module_name_config : Dict [str , Optional [QuantizationConfig ]] = {}
334334
335335 def set_global (self , quantization_config : QuantizationConfig ) -> TOSAQuantizer :
336- """Set quantization_config for submodules that are not already annotated by name or type filters."""
336+ """
337+ Set quantization_config for submodules that are not already annotated by name or type filters.
338+
339+ Args:
340+ quantization_config: The QuantizationConfig to set as global configuration.
341+ """
337342 self .global_config = quantization_config
338343 return self
339344
340345 def set_module_type (
341346 self , module_type : Callable , quantization_config : QuantizationConfig
342347 ) -> TOSAQuantizer :
343- """Set quantization_config for a submodule with type: `module_type`, for example:
348+ """
349+ Set quantization_config for a submodule with type: `module_type`, for example:
344350 quantizer.set_module_name(Sub) or quantizer.set_module_name(nn.Linear), it will quantize all supported operator/operator
345- patterns in the submodule with this module type with the given `quantization_config`
351+ patterns in the submodule with this module type with the given `quantization_config`.
352+
353+ Args:
354+ module_type: The type of the submodule to set the quantization config for.
355+ quantization_config: The QuantizationConfig to set for the submodule.
346356 """
347357 self .module_type_config [module_type ] = quantization_config
348358 return self
349359
350360 def set_module_name (
351361 self , module_name : str , quantization_config : Optional [QuantizationConfig ]
352362 ) -> TOSAQuantizer :
353- """Set quantization_config for a submodule with name: `module_name`, for example:
363+ """
364+ Set quantization_config for a submodule with name: `module_name`, for example:
354365 quantizer.set_module_name("blocks.sub"), it will quantize all supported operator/operator
355366 patterns in the submodule with this module name with the given `quantization_config`
367+
368+ Args:
369+ module_name: The name of the submodule to set the quantization config for.
370+ quantization_config: The QuantizationConfig to set for the submodule.
356371 """
357372 # Validate that quantization_config is provided
358373 if quantization_config is None :
359374 raise ValueError ("quantization_config == None is not supported yet" )
360375 self .module_name_config [module_name ] = quantization_config
361376 return self
362377
363- def set_io (self , quantization_config ):
364- """Set quantization_config for input and output nodes."""
378+ def set_io (self , quantization_config : QuantizationConfig ) -> TOSAQuantizer :
379+ """
380+ Set quantization_config for input and output nodes.
381+
382+ Args:
383+ quantization_config: The QuantizationConfig to set for input and output nodes.
384+ """
365385 self .io_config = quantization_config
366386 return self
367387
368388 def transform_for_annotation (self , model : GraphModule ) -> GraphModule :
369- """An initial pass for transforming the graph to prepare it for annotation.
389+ """
390+ An initial pass for transforming the graph to prepare it for annotation.
370391 Currently transforms scalar values to tensor attributes.
392+
393+ Args:
394+ model: The model to transform.
395+ Returns:
396+ The transformed model.
371397 """
372398
373399 # TODO: Fix the need to lazily import this.
@@ -465,10 +491,24 @@ def validate(self, model: GraphModule) -> None:
465491
466492
467493class EthosUQuantizer (TOSAQuantizer ):
494+ """
495+ Quantizer supported by the Arm Ethos-U backend.
496+
497+ Args:
498+ compile_spec: A EthosUCompileSpec instance.
499+ """
500+
468501 def __init__ (self , compile_spec : EthosUCompileSpec ) -> None :
469502 super ().__init__ (compile_spec )
470503
471504
472505class VgfQuantizer (TOSAQuantizer ):
506+ """
507+ Quantizer supported by the Arm Vgf backend.
508+
509+ Args:
510+ compile_spec: A VgfCompileSpec instance.
511+ """
512+
473513 def __init__ (self , compile_spec : VgfCompileSpec ) -> None :
474514 super ().__init__ (compile_spec )
0 commit comments