“Pytorch verifique si el tensor está en GPU” Código de respuesta

TensorFlow Check GPU

tf.config.list_physical_devices('GPU')
Splendid Scarab

Pytorch check gpu

In [1]: import torch

In [2]: torch.cuda.current_device()
Out[2]: 0

In [3]: torch.cuda.device(0)
Out[3]: <torch.cuda.device at 0x7efce0b03be0>

In [4]: torch.cuda.device_count()
Out[4]: 1

In [5]: torch.cuda.get_device_name(0)
Out[5]: 'GeForce GTX 950M'

In [6]: torch.cuda.is_available()
Out[6]: True
Worrisome Weasel

Consulte GPU en TensorFlow

# For tensorflow 2:
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))

# For tensorflow 1:
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
Lazy Lizard

Pytorch verifique si el tensor está en GPU

tensor.is_cuda 
Jolly Jellyfish

Respuestas similares a “Pytorch verifique si el tensor está en GPU”

Preguntas similares a “Pytorch verifique si el tensor está en GPU”

Más respuestas relacionadas con “Pytorch verifique si el tensor está en GPU” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código