参考  torch.cuda - 云+社区 - 腾讯云

torch.cuda.set_device(device)[source]

Sets the current device.

Usage of this function is discouraged in favor of device. In most cases it’s better to use CUDA_VISIBLE_DEVICES environmental variable.

Parameters:

  • device (torch.device or int) – selected device. This function is a no-op if this argument is negative.

Logo

讨论HarmonyOS开发技术,专注于API与组件、DevEco Studio、测试、元服务和应用上架分发等。

更多推荐