Returns the canonical lower-case name for a device tag.
The string form is what surfaces in error messages, repr(tensor)
output, and the Python Device wrapper's __str__.
Parameters
dDeviceDevice tag to convert.
Returns
std::string_view"cpu" for Device::CPU, "gpu" for Device::GPU. The returned view points into a static string literal — safe to store beyond the call site.
Raises
:logic_errorThe enum was extended without updating this switch. Indicates a missing recompile of all translation units.
Examples
const auto name = device_name(Device::GPU); // "gpu"