解决方法:
更换包的顺序,将Torch的包放在matplotlib的前面
import os
import argparse
import numpy as np
from matplotlib import pyplot as plt
import torch
import torch.backends.cudnn as cudnn
改为:
import os
import argparse
import numpy as np
import torch
import torch.backends.cudnn as cudnn
from matplotlib import pyplot as plt