You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I was trying to use DeepExplain on a tensorflow model which has two inputs:
One is the input to the network with shape (?, 5000)
The other is the batch_size with an unknown shape
So when I am trying to use explain method:
from deepexplain.tensorflow import DeepExplain
sess = Model.sess
X = Model.x
B = Model.batch_size
T = Model.z
index = 0
with DeepExplain(session = sess) as de:
attributions = []
output_size = T.shape[-1]
mask = np.zeros((1, output_size))
mask[0][index] = 1
att = de.explain("deeplift", T * mask, [X, B], [data, 256])
I get the following error:
c:\users\matin\src\deepexplain\deepexplain\tensorflow\methods.py in _set_check_baseline(self)
178 if self.baseline is None:
179 if self.has_multiple_inputs:
--> 180 self.baseline = [np.zeros([1,] + xi.get_shape().as_list()[1:]) for xi in self.X]
181 else:
182 self.baseline = np.zeros([1,] + self.X.get_shape().as_list()[1:])
"as_list() is not defined on an unknown TensorShape."
Is there a way to get around it?
The text was updated successfully, but these errors were encountered:
The assumption is that all inputs have batch_size as the first dimension of the input tensor. This is what Keras does. As you have a pure TF model, it might be possible to fix DeepExplain to handle this case but it might be easier to define the size of your second input (which is always [1] as far as I understood)
Looking closer, the current DeepExplain requires each input to be at least two-dimensional. A workaround could be to define your second input as having shape [[1]]
On a similar note, I would like to use the occlusion techniques on a network where model.input shape is (?, 3, 224, 224), model.output shape is (?, 1000).
This of course works without any problems for the non-occlusion methods.
For both I tried to reshape the tensor via tf.reshape() to (1, 3, 224, 224) and (1, 1000) respectively. However, this deletes the metadata of the keras model 👎 .
Just copying the name to the new one was also successful unfortunately. I got the following error: ValueError: 'model_1/output_0/BiasAdd:0' is not a valid scope name.
Since I can not add a keras reshape layer once the model is trained, I am not really sure how to proceed. Maybe there is an easy fix for that?
Hi,
I was trying to use DeepExplain on a tensorflow model which has two inputs:
So when I am trying to use explain method:
I get the following error:
"as_list() is not defined on an unknown TensorShape."
Is there a way to get around it?
The text was updated successfully, but these errors were encountered: