Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert tensor dtype=tf.float32_ref to dtype=tf.float32?

Tags:

tensorflow

I want to use the modify word_embeddings dtype from float32_ref to float32 through the function tf.cast():

   word_embeddings_modify=tf.cast(word_embeddings,dtype=tf.float32)

But it did not work as expected and word_embeddings_modify dtype still tf.float32_ref.

   word_embeddings = tf.scatter_nd_update(var_output, error_word_f,sum_all)
   word_embeddings_modify=tf.cast(word_embeddings,dtype=tf.float32)
   word_embeddings_dropout = tf.nn.dropout(word_embeddings_2, dropout_pl)
like image 857
user9799714 Avatar asked Oct 21 '25 01:10

user9799714


1 Answers

You can dereference a _ref type using tf.identity

word_embeddings = tf.identity(word_embeddings)
like image 83
nessuno Avatar answered Oct 24 '25 09:10

nessuno



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!