auto_device: Auto Device

View source: R/utils.R

auto_deviceR Documentation

Auto Device

Description

Resolves the device parameter of a learner. "auto" becomes "cuda" when a CUDA device is available and "cpu" otherwise; any other value is returned unchanged, except that an explicit "cuda" (or "cuda:<index>") without an available CUDA device with that index is an error rather than a failure deep inside libtorch later on.

Usage

auto_device(device = NULL)

Arguments

device

(character(1))
The device. If not NULL, is returned as is.


mlr3torch documentation built on Oct. 30, 2026, 5:10 p.m.