New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try to call tf.select but get AttributeError: 'module' object has no attribute 'select' #8647
Comments
Is Tensorflow imported correctly as tf in the file throwing the error?
Please check your import statement. |
@jubjamie |
Can you please post the code of the file causing problems? I will try and reproduce the problem. |
I found in the new version of tensorflow, there was one file named select.py added to tensorflow.contrib.graph_editor and it seems tensorflow.contrib is lazily imported in init.py. Is this the reason? |
@jubjamie
|
Would you mind editing your above comment to put it all in code with correct indentation and formatting please? Just to make sure everything is written as it should be! In the mean time I will try a little test here. |
@jubjamie |
@jubjamie |
Problem solved. Can you please confirm what version of tensorflow you are using? |
@jubjamie Am I right? If it's the reason, except using the previous version, is there any way I can solve it? |
tf.select is deprecated that's why. I can't believe I didn't spot that at first! Let me know if that solves your problem. |
@jubjamie So the exact version should be 1.0.1 I think. |
Yeah that's fine. Try using tf.where() instead as tf.select is a deprecated control function. Maybe that's why you are seeing it in contrib? Would have to ask a Tensorflower! |
@jubjamie |
Yes. tf.where used to have a similar but different functionality. If this solved then feel free to close the issue. |
@jubjamie |
I'm out the office now but if you can create a stackoverflow question, link it here and then close the issue that would be great as Google like to keep this clear for bugs. I'll try and get back to you tomorrow. |
@jubjamie thank you for your responses! I'm gonna close this issue. |
Here is the traceback information:
Traceback (most recent call last):
File "guidedBack.py", line 149, in
grads = K.gradients(model.layers[-2].output[0, 0], model.layers[-6].layers[-2].output)[0]
File "/N/u/zehzhang/myTensorflow/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 2108, in gradients
return tf.gradients(loss, variables, colocate_gradients_with_ops=True)
File "/N/u/zehzhang/myTensorflow/lib/python2.7/site-packages/tensorflow/python/ops/gradients_impl.py", line 482, in gradients
in_grads = grad_fn(op, *out_grads)
File "guidedBack.py", line 25, in _GuidedReluGrad
return tf.select(0. < grad, gen_nn_ops._relu_grad(grad, op.outputs[0]), tf.zeros(grad.get_shape()[1:]))
AttributeError: 'module' object has no attribute 'select'
Anyone has any idea?
The text was updated successfully, but these errors were encountered: