shap问题

shap问题
试了好多方法,弄了一天,
总是出现The Session graph is empty. Add operations to the graph before calling run().
还有raise TypeError("Tensor is unhashable. " “Instead, use tensor.ref() as the key.”) E TypeError: Tensor is unhashable. Instead, use tensor.ref() as the key.
或者(KerasTensor(type_spec=TensorSpec(shape=(?, 30, 27), dtype=tf.float32, name=‘module_wrapper_1_input’), name=‘module_wrapper_1_input’, description=“created by layer ‘module_wrapper_1_input’”))Instead, use tensor.ref() as the key.
在shap上面加了下面三行代码还是不行,后面发现把三行代码放在开头就可以了
import tensorflow as tf
tf.compat.v1.disable_v2_behavior()
tf.compat.v1.disable_eager_execution()

哎,好多csdn都没解决,还是在github上看见回答,以后还是不要畏惧英文啊
https://github.com/slundberg/shap/issues/1694

你可能感兴趣的:(tensorflow,python,深度学习)