Last active
May 2, 2018 07:19
-
-
Save yongjun823/93a210e53adf2c025a5b8ea3264c2870 to your computer and use it in GitHub Desktop.
pytorch load pretraining model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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