infocusp / tf_cnnvis

CNN visualization tool in TensorFlow
MIT License
781 stars 208 forks source link

AttributeError: module 'tensorflow.python.ops.gen_nn_ops' has no attribute '_relu_grad' #50

Closed foreverYoungGitHub closed 6 years ago

foreverYoungGitHub commented 6 years ago

Currently, I'm using tensorflow 1.8. When I run the example code with the deconv_visualization() function.

It returns error:

  File "/Yang/project/detection/code/tf18/third_party/tf_cnnvis/tf_cnnvis/tf_cnnvis.py", line 43, in _GuidedReluGrad
    return tf.where(0. < grad, gen_nn_ops._relu_grad(grad, op.outputs[0]), tf.zeros_like(grad))
AttributeError: module 'tensorflow.python.ops.gen_nn_ops' has no attribute '_relu_grad'

Do you have any idea about that. I'm really appreciate that!

ggaziv commented 6 years ago

Getting similar error when running deconv_visualization. Note that this exception occurs following exceptions that has to do with 'Xla': tf_cnn_vis_Example2.ipynb

-> 2327           c_api.TF_OperationGetAttrValueProto(self._c_op, name, buf)
...
InvalidArgumentError: Operation 'Relu' has no attr named '_XlaCompile'.

Or: tf_cnn_vis_Example1.ipynb

ValueError: Operation 'conv1' has no attr named '_XlaCompile'.

Using Anaconda 3.6 with tensorflow 1.8 on either CentOS 7.2 or macOS.

tengerye commented 6 years ago

Me, too. I have almost the same errors as @ggaziv . I work on Ubuntu 16.04.

tengerye commented 6 years ago

I successfully fix it. According to this post, change _relu_grad to relu_grad. @foreverYoungGitHub @ggaziv

ggaziv commented 6 years ago

Works great ! Thanks @tengerye !

BhagyeshVikani commented 6 years ago

Thanks @tengerye Closing this now.