张量转换请求使用dtype float32的Tensor的dtype float32_ref?

时间:2019-01-06 05:22:32

标签: tensorflow

张量转换要求dtype float32_ref为具有dtype float32的张量?

word_embeddings = tf.scatter_nd_update(var_output, error_word_f, sum_all)
word_embeddings_2 = tf.nn.dropout(word_embeddings, self.dropout_pl)

错误提示如下:

ValueError: Tensor conversion requested dtype float32_ref for Tensor with dtype float32: 'Tensor("dropout:0", shape=(), dtype=float32)

看起来word_embeddings的dtype是float32_ref,但实际的功能tf.nn.dropout需要word_embeddings的dtype float32,我如何才能将word_embeddings的dtype的float32_ref转换为float32运行tf.nn.dropout(word_embeddings, self.dropout_pl)

0 个答案:

没有答案