tensorflow 无法获得正确的输出

wfsdck30  于 4个月前  发布在  其他
关注(0)|答案(2)|浏览(57)

问题类型

构建/安装

你是否在TensorFlow Nightly版本中复现了这个bug?

是的

问题来源

源代码

TensorFlow版本

tensorflow-gpu 1.14.0

自定义代码

是的

OS平台和发行版

Windows 11专业版23H2

移动设备

Windows 11专业版23H2

Python版本

3.6

Bazel版本

  • 无响应*

GCC/编译器版本

  • 无响应*

CUDA/cuDNN版本

cuda 10.0.130 cuDnn 7.6.5

GPU型号和内存大小

NVIDIA GeForce RTX 3060 12GB内存

当前行为?

当我使用tensorflow-gpu.14.0测试模型时,它不会立即输出结果,而是在"sess.run"点上卡住数秒。这种情况只发生在向模型输入的第一个图像上,而后续输入的处理速度是正常的。当我检查结果时,我还发现输出是不正确的。

我相信模型本身不是问题所在,因为我在使用CPU版本的TensorFlow时可以得到正确的结果。因此,我想了解错误发生在哪里。以下是一些具体的配置:

“Path”中的环境变量:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDAv10.0\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\include
C:Program Files\NVIDIA GPU Computing ToolkitCUDA\v10.0lib
C:\Program FilesNVIDIA GPU Computing Toolkit\CUDA\v10.0\libnvvp

独立代码重现问题

I am unable to provide a test code, because this is not a problem with the model itself. I would be very grateful if you can help me solve my problem!

相关日志输出

  • 无响应*
mfuanj7w

mfuanj7w1#

你好,@JJGNB ,
对于延迟,我们看到您正在使用旧版本的TensorFlow(1.x),该版本不再受到积极支持。我们建议您升级到2.17.0,并告知我们问题是否在新版本中仍然存在。
谢谢!

wqsoz72f

wqsoz72f2#

Hi @JJGNB,

这是一个关于使用旧版本的TensorFlow(1.x)构建的项目,很难将其转换为TensorFlow 2.0。即使在另一个项目中使用TensorFlow 2.0,问题仍然存在。

更具体地说,以下是使用TensorFlow 1.14.0时的命令行输出:

D:\ANA\envs\JJGNBTF\lib\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
 _np_qint8 = np.dtype([("qint8", np.int8, 1)])
 D:\ANA\envs\JJGNBTF\lib\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
 _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
 D:\ANA\envs\JJGNBTF\lib\site-packages\tensorflow\python\framework\dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
 _np_qint16 = np.dtype([("qint16", np.int16, 1)])
 D:\ANA\envs\JJGNBTF\lib\site-packages\tensorflow\python\framework\dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
 _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
 D:\ANA\envs\JJGNBTF\lib\site-packages\tensorflow\python\framework\dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
 _np_qint32 = np.dtype([("qint32", np.int32, 1)])
 D:\ANA\envs\JJGNBTF\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
 _np_qint8 = np.dtype([("qint8", np.int8, 1)])
 D:\ANA\envs\JJGNBTF\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
 _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
 D:\ANA\envs\JJGNBTF\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
 _np_qint16 = np.dtype([("qint16", np.int16, 1)])
 D:\ANA\envs\JJGNBTF\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
 _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
 D:\ANA\envs
2024-08-27 18:36:51.513841: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
 2024-08-27 18:36:51.516747: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties:
 name: NVIDIA GeForce RTX 3060 major: 8 minor: 6 memoryClockRate(GHz): 1.867
 pciBusID: 0000:01:00.0
 2024-08-27 18:36:51.516899: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
 2024-08-27 18:36:51.516997: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1763] Adding visible gpu devices: 0
 2024-08-27 18:39:26.925472: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] Device interconnect StreamExecutor with strength 1 edge matrix:
 2024-08-27 18:39:26.925596: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187] 0
 2024-08-27 18:39:26.925631: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 0: N
 2024-08-27 18:39:26.926202: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 9681 MB memory) -> physical GPU (device: 0, name: NVIDIA GeForce RTX 3060, pci bus id: 0000:01:00.0, compute capability: 8.6)
 WARNING:tensorflow:From E:\compare_algor\DDBF-main\DDBF-main\evaluate_DDBF.py:31: The name tf.placeholder_with_default is deprecated. Please use tf.compat.v1.placeholder_with_default instead.
 WARNING:tensorflow:From E:\compare_algor\DDBF-main\DDBF-main\model.py:25: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.
 WARNING:tensorflow:From E:\compare_algor\DDBF-main\DDBF-main\model.py:25: The name tf.AUTO_REUSE is deprecated. Please use tf.compat.v1.AUTO_REUSE instead.
 WARNING:tensorflow:Entity <bound method Conv.call of <tensorflow.python.layers.convolutional.Conv2D object at 0x00000197281B53C8>> could not be transformed and will be executed as-is. Please report this to the AutgoGraph team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10` ) and attach the full output. Cause: converting <bound method Conv.call of <tensorflow.python.layers.convolutional.Conv2D object at 0x00000197281B53C8>>: AttributeError: module 'gast' has no attribute 'Str'
 WARNING:tensorflow:Entity <bound method Conv.call of <tensorflow.python.layers.convolutional.Conv2D object at 0x00000197281B5CF8>> could not be transformed and will be executed as-is. Please report this to the AutgoGraph team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10` ) and attach the full output. Cause: converting <bound method Conv.call of <tensorflow.python.layers.convolutional.Conv2D object at 0x00000197281B5CF8>>: AttributeError: module 'gast' has no attribute 'Str'
 WARNING:tensorflow:Entity <bound method Conv.call of <tensorflow.python
这是一个关于TensorFlow的警告信息,提示在某个文件中使用了已经被弃用的`tf.train.Saver`。建议使用`tf.compat.v1.train.Saver`替代。

相关问题