Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

index 0 is out of bounds for axis 0 with size 0 #42

Open
sherlock42 opened this issue Mar 22, 2019 · 1 comment
Open

index 0 is out of bounds for axis 0 with size 0 #42

sherlock42 opened this issue Mar 22, 2019 · 1 comment

Comments

@sherlock42
Copy link

sherlock42 commented Mar 22, 2019

I am trying to to do it for 3 channel images with 2 classes.
on running the following code

from utils import plot, plt
%matplotlib inline
n_cols = 4
n_rows = int(len(attributions_gradin) / 2)
fig, axes = plt.subplots(nrows=n_rows, ncols=n_cols, figsize=(3*n_cols, 3*n_rows))

for i, a1 in enumerate(attributions_gradin):
    row, col = divmod(i, 2)
    plot(xs[i].reshape(224,224,3), cmap='Greys', axis=axes[row, col*3]).set_title('Original')
    plot(a1.reshape(224,224,3), xi = xs[i], axis=axes[row,col*3+1]).set_title('Grad*Input')
#     plot(a2.reshape(28,28), xi = xs[i], axis=axes[row,col*3+2]).set_title('Shapley Values')`

I am getting the error

IndexError                                Traceback (most recent call last)
<ipython-input-74-77779a4b2a3b> in <module>()
      8 for i, a1 in enumerate(attributions_gradin):
      9     row, col = divmod(i, 2)
---> 10     plot(xs[i].reshape(224,224,3), cmap='Greys', axis=axes[row, col*3]).set_title('Original')
     11     plot(a1.reshape(224,224,3), xi = xs[i], axis=axes[row,col*3+1]).set_title('Grad*Input')
     12 #     plot(a2.reshape(28,28), xi = xs[i], axis=axes[row,col*3+2]).set_title('Shapley Values')

IndexError: index 0 is out of bounds for axis 0 with size 0
@marcoancona
Copy link
Owner

This does not look like a problem with the library but rather a problem with access to axes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants