Got TypeError when running VGG example
Opened this issue · 1 comments
Auptla commented
The error log is below:
TypeError Traceback (most recent call last)
<ipython-input-15-73a1b345b022> in <module>()
----> 1 ig = integrated_gradients(model)
/home/ubuntu/GA/IntegratedGradients-master/IntegratedGradients.py in __init__(self, model, outchannels, verbose)
73 gradients = self.model.optimizer.get_gradients(self.model.output[:, c], self.model.input)
74 if K.backend() == "theano":
---> 75 gradients = self.model.optimizer.get_gradients(self.model.output[:, c].sum(), self.model.input)
76
77 # Build computational graph that computes the tensors given inputs
/home/ubuntu/anaconda3/envs/theano_p27/lib/python2.7/site-packages/keras/optimizers.pyc in get_gradients(self, loss, params)
88 def get_gradients(self, loss, params):
89 grads = K.gradients(loss, params)
---> 90 if None in grads:
91 raise ValueError('An operation has `None` for gradient. '
92 'Please make sure that all of your ops have a '
/home/ubuntu/anaconda3/envs/theano_p27/lib/python2.7/site-packages/theano/tensor/var.pyc in __iter__(self)
630 except TypeError:
631 # This prevents accidental iteration via builtin.sum(self)
--> 632 raise TypeError(('TensorType does not support iteration. '
633 'Maybe you are using builtin.sum instead of '
634 'theano.tensor.sum? (Maybe .max?)'))
TypeError: TensorType does not support iteration. Maybe you are using builtin.sum instead of theano.tensor.sum? (Maybe .max?)
Auptla commented
it only wrong with theano backend,
it works well with tensorflow backend