/usr/local/lib64/python3.6/site-packages/torch/ao/quantization/__pycache__
NameSizeModeActions
fake_quantize.cpython-36.pyc139970644editdlrm
fuser_method_mappings.cpython-36.pyc45210644editdlrm
fuse_modules.cpython-36.pyc50120644editdlrm
observer.cpython-36.pyc392270644editdlrm
qconfig.cpython-36.pyc85840644editdlrm
quantization_mappings.cpython-36.pyc68670644editdlrm
quantize.cpython-36.pyc189010644editdlrm
quantize_jit.cpython-36.pyc86310644editdlrm
quant_type.cpython-36.pyc6340644editdlrm
stubs.cpython-36.pyc27160644editdlrm
utils.cpython-36.pyc66890644editdlrm
_correct_bias.cpython-36.pyc44490644editdlrm
_equalize.cpython-36.pyc57040644editdlrm
_learnable_fake_quantize.cpython-36.pyc64550644editdlrm
__init__.cpython-36.pyc2530644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/torch/ao/quantization/__pycache__/qconfig.cpython-36.pyc (8584B)
3 Eg-@sddlmZddlmZmZmZddlZddljZddl m Z m Z m Z m Z mZmZmZmZddlmZmZmZmZmZmZmZmZmZmZGdddedd d gZeeed Zeeed Zeeed Z Gd ddedd d gZ!e!eed Z"e!ej#ej$dej#ej%dd Z&e!ej#ej%dej#ej%dd Z'e!eed Z(e!eed Z)ee e d Z*eejj+e d Z,ee ejj+d Z-eeed Z.dddZ/dddZ0eeee!fejj1ddddZ2eee!dfZ3e3eej1dfedddZ4e3e3dddZ5dS) ) namedtuple)UnionOptionalAnyN) FakeQuantizedefault_fake_quant%default_per_channel_weight_fake_quantdefault_weight_fake_quantdefault_fused_act_fake_quantdefault_fused_wt_fake_quantFusedMovingAvgObsFakeQuantize'default_fused_per_channel_wt_fake_quant) HistogramObserverMovingAverageMinMaxObserverPlaceholderObserverdefault_debug_observerdefault_dynamic_quant_observerdefault_float_qparams_observerdefault_observer#default_per_channel_weight_observerdefault_placeholder_observerdefault_weight_observercs eZdZdZfddZZS)QConfiga Describes how to quantize a layer or a part of the network by providing settings (observer classes) for activations and weights respectively. Note that QConfig needs to contain observer **classes** (like MinMaxObserver) or a callable that returns instances on invocation, not the concrete observer instances themselves. Quantization preparation function will instantiate observers multiple times for each of the layers. Observer classes have usually reasonable default arguments, but they can be overwritten with `with_args` method (that behaves like functools.partial): my_qconfig = QConfig(activation=MinMaxObserver.with_args(dtype=torch.qint8), weight=default_observer.with_args(dtype=torch.qint8)) cs4t|tjst|tjr tdtt|j|||S)NzHQConfig received observer instance, please pass observer class instead. zLUse MyObserver.with_args(x=1) to override arguments to constructor if neededzQConfig received observer instance, please pass observer class instead. Use MyObserver.with_args(x=1) to override arguments to constructor if needed) isinstancennModule ValueErrorsuperr__new__)cls activationweight) __class__I/usr/local/lib64/python3.6/site-packages/torch/ao/quantization/qconfig.pyr/szQConfig.__new__)__name__ __module__ __qualname____doc__r __classcell__r$r$)r#r%rsrr!r")r!r")r"r!cs.eZdZdZejjejjffdd ZZS)QConfigDynamica Describes how to dynamically quantize a layer or a part of the network by providing settings (observer classes) for weights. It's like QConfig, but for dynamic quantization. Note that QConfigDynamic needs to contain observer **classes** (like MinMaxObserver) or a callable that returns instances on invocation, not the concrete observer instances themselves. Quantization function will instantiate observers multiple times for each of the layers. Observer classes have usually reasonable default arguments, but they can be overwritten with `with_args` method (that behaves like functools.partial): my_qconfig = QConfigDynamic(weight=default_observer.with_args(dtype=torch.qint8)) cs(t|tjrtdtt|j|||S)NzOQConfigDynamic received observer instance, please pass observer class instead. zLUse MyObserver.with_args(x=1) to override arguments to constructor if neededzQConfigDynamic received observer instance, please pass observer class instead. Use MyObserver.with_args(x=1) to override arguments to constructor if needed)rrrrrr+r)r r!r")r#r$r%rPs zQConfigDynamic.__new__) r&r'r(r)torchrIdentityrr*r$r$)r#r%r+@sr+)ZdtypefbgemmcCsD|dkrttjddtd}n"|dkrszcadd_module_to_qconfig_obs_ctr..get_factory_kwargs_based_on_module_device..cSsh|] }|jqSr$)rA)rBrCr$r$r%rDsrrA) rr,rrr> parametersbufferslennextiter)ZdevicesrA)r@r$r%)get_factory_kwargs_based_on_module_devices zPadd_module_to_qconfig_obs_ctr..get_factory_kwargs_based_on_module_devicec sJy|jdd}||jdStk r2|Stk rD|SXdS)N)Zfactory_kwargs)r1Zwith_callable_argsAttributeError TypeError)Zoriginal_constructorcheck)rJr$r%1configure_constructor_to_put_obs_on_module_devices  zXadd_module_to_qconfig_obs_ctr..configure_constructor_to_put_obs_on_module_device)r!r")_fieldsr!r"rrr+)r4r@rNr!r"r$)rJr@r%add_module_to_qconfig_obs_ctrs     rP)q1q2c Csvdd}|dks|dkr ||kS|dk r0|dk s4ty$||jj|jjoX||jj|jjStk rp||kSXdS)NcSs,|j|jk}|o|j|jk}|o*|j|jkS)N)funcargskeywords)p1p2Zsamer$r$r%partial_equalss z&qconfig_equals..partial_equals)r>r!rCr"rK)rQrRrXr$r$r%qconfig_equalss$rY)r.)r.r)6 collectionsrtypingrrrr,Ztorch.nnrZ#torch.ao.quantization.fake_quantizerrrr r r r r r7rrrrrrrrrrrr2Zdefault_debug_qconfigZdefault_per_channel_qconfigr+Zdefault_dynamic_qconfigr1Zfloat32Zfloat16Zfloat16_dynamic_qconfigZfloat16_static_qconfigZper_channel_dynamic_qconfigZ!float_qparams_weight_only_qconfigr8r-Zdefault_weight_only_qconfigZdefault_activation_only_qconfigr9r5r;rr?Z QConfigAnyrPrYr$r$r$r%sP  ( 0    # ,