tensorflow,pytorch,paddle 测试GPU是否可用

2022-09-29 08:28:57

1、tensorflow

import tensorflow as tf
print(tf.test.is_gpu_available())
print(tf.config.list_physical_devices('GPU'))

2、pytorch

import torch
print(torch.cuda.is_available())
print(torch.Tensor(5, 3).cuda())

3、paddlepaddle

import paddle
paddle.fluid.install_check.run_check()

paddle.fluid.is_compiled_with_cuda()
  • 作者:欧晨eli
  • 原文链接:https://eli-coin.blog.csdn.net/article/details/125168939
    更新时间:2022-09-29 08:28:57