gpt4 book ai didi

tensorflow 错误: Cannot assign a device for operation 'Tile'

转载 作者:行者123 更新时间:2023-12-02 12:40:58 25 4
gpt4 key购买 nike

tf.tile 操作无法在 GPU 设备上执行。这段代码:

import tensorflow as tf

with tf.device('/gpu:0'):
tt = tf.tile(tf.range(4), [3])

with tf.Session() as sess:
print(sess.run(tt))

结果:

Caused by op u'Tile', defined at:
File "test_tf3.py", line 6, in <module>
tt = tf.tile(tf.range(4), [3])
File "/media/awork/home/astepochkin/drecs/repo/env/local/lib/python2.7/site-packages/tensorflow/python/ops/gen_array_ops.py", line 3847, in tile
name=name)
File "/media/awork/home/astepochkin/drecs/repo/env/local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op
op_def=op_def)
File "/media/awork/home/astepochkin/drecs/repo/env/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2630, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/media/awork/home/astepochkin/drecs/repo/env/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1204, in __init__
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

InvalidArgumentError (see above for traceback): Cannot assign a device for operation 'Tile': Could not satisfy explicit device specification '/device:GPU:0' because no supported kernel for GPU devices is available.
[[Node: Tile = Tile[T=DT_INT32, Tmultiples=DT_INT32, _device="/device:GPU:0"](range, Tile/multiples)]]

我研究了 tensorflow 源代码并找到了为 GPU 实现图 block 的文件。所以我不明白为什么它不起作用。有人可以帮我吗?

最佳答案

这是因为你的类型是int32,并且没有为该类型注册GPU内核。

关于 tensorflow 错误: Cannot assign a device for operation 'Tile' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45552672/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com