daily pastebin goal
51%
SHARE
TWEET

Untitled

a guest Oct 21st, 2018 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # 选择设备,选择使用GPU(cuda)训练
  2.  
  3. # first way
  4. if torch.cuda.is_available():
  5.     device = torch.device("cuda:0")
  6. else:
  7.     device = torch.device("cpu")
  8.  
  9.  
  10. # second way
  11. device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top