tensor 转 numpy 一下提醒cpu,一下又说datach,然后我两个都加了就好了。 修改前: output=output.numpy() 修改后: output=output.cpu().detach().numpy()