使用torchsummary时出现错误RuntimeError: Expected all tensors to be on the same device, ...

RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cuda:1!

model = CNN().to(device)
print(summary(model, (1, wn, ws, 6)))

改为

print(summary(CNN().to('cuda'), (1, wn, ws, 6), device='cuda'))

版权声明:本文为kane7csdn原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。