net.eval.to(device)

AttributeError: 'function' object has no attribute 'to'

原:

model=model.load_state_dict(torch.load("bestmodel.pth"))
model=model.to(device)# Or the following 
model.eval()

改为:

model.load_state_dict(torch.load("bestmodel.pth"))
model=model.to(device)# Or the following 
model.eval()

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐