QAT(resnet18)#

import torch
import torch.nn as nn
import torchvision
import torch.quantization
import torch.quantization._numeric_suite as ns
from torch.quantization import (
    default_eval_fn,
    default_qconfig,
    quantize,
)

# 设置 warnings
import warnings
warnings.filterwarnings(
    action='ignore',
    category=DeprecationWarning,
    module='.*'
)
warnings.filterwarnings(
    action='default',
    module='torch.quantization'
)
warnings.filterwarnings(
    action='default',
    module='torch.ao.quantization'
)