Pytorch expression "torch.cuda.get_device_name(0)" is not work, may be there is another way to check my GPU's name?

I think maybe my cuda environment is something wrong? Thanks for your help.

What happens if you run the following script?

import torch

if torch.cuda.is_available():
    n_gpus = torch.cuda.device_count()
    
    print("GPUs detected: = {}".format( torch.cuda.device_count() ) )
    
    for i in range(n_gpus):
        print("_______")
        print( torch.cuda.get_device_name( i ) )
        print("_______")
        
else:
    print("No GPUs detected")
1 Like