CPU device for tutorials

Reviewed By: nikhilaravi

Differential Revision: D22357376

fbshipit-source-id: c103f9b0c798d4425d642781b5bfbb1a27310270
This commit is contained in:
Jeremy Reizenstein
2020-07-03 08:51:19 -07:00
committed by Facebook GitHub Bot
parent 52979226bc
commit 275ddade66
5 changed files with 46 additions and 29 deletions

View File

@@ -217,8 +217,11 @@
"outputs": [],
"source": [
"# Setup\n",
"device = torch.device(\"cuda:0\")\n",
"torch.cuda.set_device(device)\n",
"if torch.cuda.is_available():\n",
" device = torch.device(\"cuda:0\")\n",
" torch.cuda.set_device(device)\n",
"else:\n",
" device = torch.device(\"cpu\")\n",
"\n",
"# Set paths\n",
"DATA_DIR = \"./data\"\n",