首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在GPU上使用tensorflow训练模型,使用Adadelta优化器无法工作。但当我用Adam替换Adadelta时,似乎没有任何问题。

在GPU上使用tensorflow训练模型,使用Adadelta优化器无法工作。但当我用Adam替换Adadelta时,似乎没有任何问题。
EN

Stack Overflow用户
提问于 2018-07-31 03:06:59
回答 1查看 173关注 0票数 1

我正尝试在tensorflow(python2上的v1.9.0)上使用adadelta优化器在GPU上训练一个模型。它显示以下错误。

代码语言:javascript
运行
复制
InvalidArgumentError (see above for traceback): Cannot assign a device for operation 'embedding_matrix_de/read': Could not satisfy explicit device specification '' because the node was colocated with a group of nodes that required incompatible device '/job:localhost/replica:0/task:0/device:GPU:0'
Colocation Debug Info:
Colocation group had the following types and devices: 
UnsortedSegmentSum: GPU CPU 
Unique: GPU CPU 
Shape: GPU CPU 
Cast: GPU CPU 
StridedSlice: GPU CPU 
GatherV2: GPU CPU 
SparseApplyAdadelta: CPU 
Const: GPU CPU 
Identity: CPU 
VariableV2: GPU CPU 

Colocation members and user-requested devices:
  embedding_matrix_de (VariableV2) 
  embedding_matrix_de/read (Identity) 
  embedding_lookup/axis (Const) 
  embedding_lookup (GatherV2) 
  gradients/embedding_lookup_grad/Shape (Const) 
  gradients/embedding_lookup_grad/ToInt32 (Cast) 
  embedding_matrix_de/Adadelta (VariableV2) 
  embedding_matrix_de/Adadelta_1 (VariableV2) 
  Adadelta/update_embedding_matrix_de/Unique (Unique) 
  Adadelta/update_embedding_matrix_de/Shape (Shape) 
  Adadelta/update_embedding_matrix_de/strided_slice/stack (Const) 
  Adadelta/update_embedding_matrix_de/strided_slice/stack_1 (Const) 
  Adadelta/update_embedding_matrix_de/strided_slice/stack_2 (Const) 
  Adadelta/update_embedding_matrix_de/strided_slice (StridedSlice) 
  Adadelta/update_embedding_matrix_de/UnsortedSegmentSum         (UnsortedSegmentSum) 
  Adadelta/update_embedding_matrix_de/SparseApplyAdadelta (SparseApplyAdadelta) 

 [[Node: embedding_matrix_de/read = Identity[T=DT_FLOAT, _class=["loc:@embedding_matrix_de"]](embedding_matrix_de)]]

当我用adam替换adadelta时,没有任何问题。下面给出了一些代码片段。

代码语言:javascript
运行
复制
....
embedding_matrix_decode = tf.get_variable(
name="embedding_matrix_de",
shape=[trainVocabSize, embedding_size],
dtype=tf.float32)
....
optimizer = tf.train.AdadeltaOptimizer()
....
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-06-18 18:32:31

我在Tensorflow 2.1.1中遇到了同样的问题。Adadelta优化器似乎不支持GPU和TPU。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51600696

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档