Q: How to fix error report like

tensorflow.python.framework.errors_impl.InvalidArgumentError: Input 0 of node 
Adam/update_embeddings/AssignSub was passed float from _recv_embeddings_0:0 
incompatible with expected float_ref

A: We can’t feed a value into a variable and optimize it in the same time (So the problem only occurs when using Optimizers). Should using ‘tf.assign()’ in graph to give value to tf.Variable

Q: How to get a tensor by name?

A: like this:

tensor = tf.get_default_graph().get_tensor_by_name("example:0")

Q: How to get variable by name?


my_var = [v for v in tf.global_variables() if v.name == "myvar_23:0"][0]