Skip to content

Instantly share code, notes, and snippets.

@yongjun823
Last active May 2, 2018 07:19
Show Gist options
  • Select an option

  • Save yongjun823/93a210e53adf2c025a5b8ea3264c2870 to your computer and use it in GitHub Desktop.

Select an option

Save yongjun823/93a210e53adf2c025a5b8ea3264c2870 to your computer and use it in GitHub Desktop.
pytorch load pretraining model
import torch
from torch.autograd import Variable
from udacity_car.data_loader import img_road_path
model = torch.load('model.pkl')
img_tensor = img_road_path(['./img/temp.jpg'])
img_tensor.unsqueeze_(0)
tt = Variable(img_tensor)
if torch.cuda.is_available():
print('cuda start')
tt = tt.cuda()
output = model(tt)
print(output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment