utkuozbulak / pytorch-cnn-visualizations

Pytorch implementation of convolutional neural network visualization techniques
MIT License
7.81k stars 1.49k forks source link

A question on grad_times_image.py #84

Closed medinabaitemirova closed 3 years ago

medinabaitemirova commented 4 years ago

Hi!

In grad_times_image.py, line 23:

grad_times_image = vanilla_grads[0] * prep_img.detach().numpy()[0]

Shouldn't vanilla_grads[0] be vanilla_grads? Otherwise, it is only using the first channel of the gradient.

Thank you!

utkuozbulak commented 4 years ago

Hey,

That's correct. It was the is batch channel but I refactored a couple of things after pushing that code which probably messed things up.

utkuozbulak commented 3 years ago

Updated with https://github.com/utkuozbulak/pytorch-cnn-visualizations/commit/7dd09a0fc04abcd2a4a3ddb47b8ea230732b8a94 , thanks for heads up.