torch_device | R Documentation |
A torch_device
is an object representing the device on which a torch_tensor
is or will be allocated.
torch_device(type, index = NULL)
type |
(character) a device type |
index |
(integer) optional device ordinal for the device type. If the device ordinal
is not present, this object will always represent the current device for the device
type, even after A |
if (torch_is_installed()) {
# Via string
torch_device("cuda:1")
torch_device("cpu")
torch_device("cuda") # current cuda device
# Via string and device ordinal
torch_device("cuda", 0)
torch_device("cpu", 0)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.