Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
m-gopichand committed Aug 20, 2024
1 parent d753d06 commit 01f04ff
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nbs/03_convolutions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,9 @@
"#|export\n",
"def_device = 'mps' if torch.backends.mps.is_available() else 'cuda' if torch.cuda.is_available() else 'cpu'\n",
"\n",
"def device():\n",
" return 'mps' if torch.backends.mps.is_available() else 'cuda' if torch.cuda.is_available() else 'cpu'\n",
" \n",
"def to_device(x, device=def_device):\n",
" if isinstance(x, torch.Tensor): return x.to(device)\n",
" if isinstance(x, Mapping): return {k:v.to(device) for k,v in x.items()}\n",
Expand Down

0 comments on commit 01f04ff

Please sign in to comment.