Skip to contents

Default torch device

Usage

default_device()

Value

Returns torch::torch_device("cuda") if torch::cuda_is_available(), or torch::torch_device("cpu") otherwise.

Examples

device <- default_device()
#> Error in cpp_cuda_is_available(): Lantern is not loaded. Please use `install_torch()` to install additional dependencies.