Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.get_device_module function

PyTorch torch.get_device_module function


PyTorch torch reference manual PyTorch torch reference manual

torch.get_device_module A function in PyTorch for getting the current device module.

Function definition

torch.get_device_module(device='cuda')


Usage examples

Example

import

torch

Get the CUDA device module

cuda_module

=

torch.

get_device_module

(

'cuda'

)

print

(

"CUDA module:"

,

cuda_module

)

Check whether CUDA is available

print

(

"CUDA available:"

,

torch.

cuda

.

is_available

(

)

)


PyTorch torch reference manual PyTorch torch reference manual