mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Summary: By adding `per-file-ignores = __init__.py: F401` into `.flake8` with `flake8>=3.7`, we can ignore F410 in all `__init__.py` without putting `# noqa: F401` line by line. http://flake8.pycqa.org/en/latest/user/options.html?highlight=per-file-ignores#cmdoption-flake8-per-file-ignores Pull Request resolved: https://github.com/pytorch/pytorch/pull/25823 Differential Revision: D17252182 Pulled By: soumith fbshipit-source-id: 87b174075b79e4078953a7521bd1a8f82405646b
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
from __future__ import absolute_import, division, print_function, unicode_literals
|
|
from .quantize import *
|
|
from .observer import *
|
|
from .qconfig import *
|
|
from .fake_quantize import *
|
|
from .fuse_modules import fuse_modules
|
|
from .stubs import *
|
|
|
|
def default_eval_fn(model, calib_data):
|
|
r"""
|
|
Default evaluation function takes a torch.utils.data.Dataset or a list of
|
|
input Tensors and run the model on the dataset
|
|
"""
|
|
for data, target in calib_data:
|
|
model(data)
|
|
|
|
_all__ = [
|
|
'QuantWrapper', 'QuantStub', 'DeQuantStub',
|
|
# Top level API for eager mode quantization
|
|
'quantize',
|
|
# Sub functions used by eager mode quantization
|
|
'prepare', 'convert',
|
|
# Sub functions for `prepare` and `swap_module`
|
|
'propagate_qconfig_', 'add_quant_dequant', 'add_observer_', 'swap_module',
|
|
'default_eval_fn', 'get_observer_dict',
|
|
# Observers
|
|
'ObserverBase', 'WeightObserver', 'observer', 'default_observer',
|
|
'default_weight_observer',
|
|
# QConfig
|
|
'QConfig', 'default_qconfig', 'default_dynamic_qconfig', 'float16_dynamic_qconfig',
|
|
# QAT utilities
|
|
'default_qat_qconfig', 'prepare_qat', 'quantize_qat',
|
|
# module transformations
|
|
'fuse_modules',
|
|
# Dynamic quantization utilities
|
|
'quantize_dynamic',
|
|
]
|