marcoancona / DeepExplain

A unified framework of perturbation and gradient-based attribution methods for Deep Neural Networks interpretability. DeepExplain also includes support for Shapley Values sampling. (ICLR 2018)
https://arxiv.org/abs/1711.06104
MIT License
720 stars 133 forks source link

RecursionError when using Keras model - multiple_input_keras.ipynb #70

Closed itsmemala closed 2 years ago

itsmemala commented 2 years ago

Hi,

I have tried to run the multiple_input_keras.ipynb example on Google Colab but I get the following error:

RecursionError Traceback (most recent call last) in () 33 target_tensor = fModel(input_tensors) 34 ---> 35 attributions = de.explain('grad*input', target_tensor, input_tensors, [_x1, _x2]) 36 print ("Attributions:\n", attributions)

422 frames /usr/local/lib/python3.7/dist-packages/keras/engine/keras_tensor.py in str(self) 308 return 'KerasTensor(type_spec=%s%s%s%s)' % ( 309 self.type_spec, inferred_value_string, --> 310 name_string, symbolic_description) 311 312 def repr(self):

RecursionError: maximum recursion depth exceeded

Zhangyang823 commented 2 years ago

你好,来信已收到~~

itsmemala commented 2 years ago

This works now. I was using TF2 but after adding the below lines at the beginning of the code, it runs: tf.compat.v1.disable_v2_behavior() tf.compat.v1.disable_eager_execution()