AffineQuantizedObserverBase#
- class torch.ao.quantization.observer.AffineQuantizedObserverBase(mapping_type, target_dtype, granularity, quant_min=None, quant_max=None, eps=None, scale_dtype=None, zero_point_dtype=None, preserve_zero=True, zero_point_domain=ZeroPointDomain.INT, **kwargs)[原始碼]#
仿射量化(pytorch/ao)的觀察器模組
- 引數
block_size (granularity and) – 量化的粒度,必須至少指定一個,如果都指定了,則 block_size 優先。當前支援的粒度型別為 PerTensor 和 PerAxis。
args (other) – 請參閱 :class:torchao.dtypes.AffineQuantizedTensor
- convert(model, observer_node)[原始碼]#
將圖中的觀察器節點轉換為其量化表示。
- 引數
model (GraphModule) – 要在其中轉換觀察器節點的圖模組。
observer_node (Node) – 要轉換的觀察器節點。
- classmethod with_args(**kwargs)[原始碼]#
允許建立類工廠的包裝器。
當需要建立具有相同建構函式引數但例項不同的類時,這可能很有用。可以與 _callable_args 一起使用。
示例
>>> Foo.with_args = classmethod(_with_args) >>> foo_builder = Foo.with_args(a=3, b=4).with_args(answer=42) >>> foo_instance1 = foo_builder() >>> foo_instance2 = foo_builder() >>> id(foo_instance1) == id(foo_instance2) False