tensorflow - 停止 TensorFlow 尝试临时加载 cuda
问题描述
我有这个代码来禁用 GPU 使用:
import numpy as np
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
import tensorflow as tf
w = tf.Variable(
[
[1.],
[2.]
])
我仍然得到这个输出,不知道为什么:
E:\MyTFProject\venv\Scripts\python.exe E:/MyTFProject/tfvariable.py
2021-11-03 14:09:16.971644: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2021-11-03 14:09:16.971644: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2021-11-03 14:09:19.563793: E tensorflow/stream_executor/cuda/cuda_driver.cc:271] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
2021-11-03 14:09:19.566793: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: newtonpc
2021-11-03 14:09:19.567793: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: mypc
2021-11-03 14:09:19.567793: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
TF 版本:'2.6.1' 无法阻止它加载 Cuda DLL。我现在不想设置 cuda。也许以后。
我正在使用最新的 PyCharm 并安装了站点中给出的 tensorflow 和 pip。
解决方案
您可以尝试使用纯 CPU 版本重新安装 tensorflow。此处提供的链接取决于您的操作系统和 python 版本: https ://www.tensorflow.org/install/pip?hl=fr#windows_1
推荐阅读
- php - PHP在第二个逗号后提取字符串
- java - RSA_verify 中预期的数据类型是什么,无法验证从 Java 生成的签名
- django - 加入多个 Django 模型
- r - 如何在 Spark 中训练具有稀疏矩阵的随机森林?
- sql - SQL Server 从其他表插入数据
- c# - 无法从 C# 执行调用 VBA 函数的 MS-Access 查询
- android-vision - 使用 Google Vision API 扫描身份证
- c# - WPF 按钮 ContentTemplate 在通过样式设置时被覆盖
- dialog - 如何从 BaseEnum 创建 Dialog Lookup MultiSelect?
- face-id - 如何以编程方式使人脸 ID 身份验证失败?