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"]
Hey Robin, I am getting the first error that you mentioned about float_ref. My question is can I accept value into a placeholder using the feed dict and then assign that value to a variable ? This is because I want to have gradients wrt to the input (which I am passing into the placeholder) and for some restrictions I dont want to use embeddings. Thanks!
I think in Tensorflow we could accept value into a placeholder and then assign its value to a variable. The snippet below could work well: