Open ziofil opened 5 years ago
@mdanatg Can I work on this issue? Also I wanted to ask that if we have to remove this line ?
Sure! Feel free to assign the issue to yourself and send me a PR. The fix should be straightforward, by replacing tf.to_float
with tf.cast`.
I'm getting this error when following this github code https://github.com/akosiorek/akosiorek.github.io/blob/master/notebooks/attention_glimpse.ipynb
The error comes when calling gaussian_glimpse() -> This is internally calling gaussian_mask() and it has to_float()
How do I solve this? I tried to search for gaussian_mask() python code in my libraries, but couldn't find it.
I'm using Tensorflow 2.0.0
I'm stuck
If you can, you should replace tf.to_float(x)
with tf.cast(x, tf.float32)
.
If that's not an option, then a very hacky way of getting past the error is to do this, just after importing:
tf.to_float = lambda x: tf.cast(x, tf.float32)
Thank you. In which source file do I need to change? I've not written tf.to_float() in my jupyter notebook. This function is getting called behind the scenes and thankfully throwing the error visibly. But, now, I don't know where could I make the change?
In that case you probably want to avoid changing code outside your notebook and your best bet it to add the tf.to_float alias, as shown above. Add the line at the top of your notebook, just below the imports.
Thank you, could you please give the exact code to add. I searched but couldn't find any
Here it is. You should run it before everything else in your notebook.
import tensorflow as tf
tf.to_float = lambda x: tf.cast(x, tf.float32)
Thank you so much! It solved my issue.
Could you please give some pointers what exactly is happening? Does this mean, I can replace the behavior of any standard function with my own function? Thank you.
I'm using TF 2.0, and I get this error when I import tangent, due to a list of non-differentiable functions that includes
tf.to_float
(line 60), which is deprecated:https://www.tensorflow.org/versions/r1.14/api_docs/python/tf/to_float