pytorch and gpu information query

  • torch.cuda.is_available()

Is cuda available;

  • torch.cuda.device_count()

Return the number of GPUs;

  • torch.cuda.get_device_name(0)

Return the gpu name, the device index starts from 0 by default;

  • torch.cuda.current_device()

Return the current device index

Guess you like

Origin blog.csdn.net/weixin_43217427/article/details/114132035