How to modify the return tensor from tf.nn.embedding_lookup()?
问题 I want to use scatter_nd_update to change the content of the tensor returned from tf.nn.embedding_lookup() . However, the returned tensor is not mutable, and the scatter_nd_update() require an mutable tensor as input. I spent a lot of time trying to find a solution, including using gen_state_ops._temporary_variable and using tf.sparse_to_dense , unfortunately all failed. I wonder is there a beautiful solution toward it? with tf.device('/cpu:0'), tf.name_scope("embedding"): self.W = tf