每层报错: an exception occurred : ('Copying from quantized Tensor to non-quantized Tensor is not allowed, please use dequantize to get a float Tensor from a quantized Tensor',).
语句: net.load_state_dict(torch.load("u2net_quant0.pt"))
官网目前给出的解决方案是使用torch.quantization.DeQuantStub
去量化张量,你可以尝试下,不行的话只能看看有没有大佬解决了。
https://pytorch.org/docs/stable/quantization.html#common-errors从这里开始有提到这个问题,然后下面有两个例子。