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

Error #1

Open
deep0learning opened this issue Jul 30, 2019 · 0 comments
Open

Error #1

deep0learning opened this issue Jul 30, 2019 · 0 comments

Comments

@deep0learning
Copy link

deep0learning commented Jul 30, 2019

Hi,
Thank you for this code.

I got the following error during tsne_vis.ipynb. Can you please help me to sort out?


TypeError Traceback (most recent call last)
~/pytorch_new_python3/lib/python3.5/site-packages/matplotlib/colors.py in to_rgba(c, alpha)
173 try:
--> 174 rgba = _colors_full_map.cache[c, alpha]
175 except (KeyError, TypeError): # Not in cache, or unhashable.

TypeError: unhashable type: 'numpy.ndarray'

During handling of the above exception, another exception occurred:

ValueError Traceback (most recent call last)
~/pytorch_new_python3/lib/python3.5/site-packages/matplotlib/axes/_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, **kwargs)
4231 try: # Then is 'c' acceptable as PathCollection facecolors?
-> 4232 colors = mcolors.to_rgba_array(c)
4233 n_elem = colors.shape[0]

~/pytorch_new_python3/lib/python3.5/site-packages/matplotlib/colors.py in to_rgba_array(c, alpha)
274 for i, cc in enumerate(c):
--> 275 result[i] = to_rgba(cc, alpha)
276 return result

~/pytorch_new_python3/lib/python3.5/site-packages/matplotlib/colors.py in to_rgba(c, alpha)
175 except (KeyError, TypeError): # Not in cache, or unhashable.
--> 176 rgba = _to_rgba_no_colorcycle(c, alpha)
177 try:

~/pytorch_new_python3/lib/python3.5/site-packages/matplotlib/colors.py in _to_rgba_no_colorcycle(c, alpha)
230 if len(c) not in [3, 4]:
--> 231 raise ValueError("RGBA sequence should have length 3 or 4")
232 if len(c) == 3 and alpha is None:

ValueError: RGBA sequence should have length 3 or 4

During handling of the above exception, another exception occurred:

ValueError Traceback (most recent call last)
in
1 plt.rcParams['figure.figsize'] = 20, 20
----> 2 plt.scatter(output_2d[:, 0], output_2d[:, 1], c=target)
3 plt.savefig('train/output_2d.png', bbox_inches='tight')
4 plt.show()

~/pytorch_new_python3/lib/python3.5/site-packages/matplotlib/pyplot.py in scatter(x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, data, **kwargs)
2862 vmin=vmin, vmax=vmax, alpha=alpha, linewidths=linewidths,
2863 verts=verts, edgecolors=edgecolors, **({"data": data} if data
-> 2864 is not None else {}), **kwargs)
2865 sci(__ret)
2866 return __ret

~/pytorch_new_python3/lib/python3.5/site-packages/matplotlib/init.py in inner(ax, data, *args, **kwargs)
1808 "the Matplotlib list!)" % (label_namer, func.name),
1809 RuntimeWarning, stacklevel=2)
-> 1810 return func(ax, *args, **kwargs)
1811
1812 inner.doc = _add_data_doc(inner.doc,

~/pytorch_new_python3/lib/python3.5/site-packages/matplotlib/axes/_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, **kwargs)
4243 "acceptable for use with 'x' with size {xs}, "
4244 "'y' with size {ys}."
-> 4245 .format(nc=n_elem, xs=x.size, ys=y.size)
4246 )
4247 # Both the mapping and the RGBA conversion failed: pretty

ValueError: 'c' argument has 60000 elements, which is not acceptable for use with 'x' with size 60000, 'y' with size 60000.

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

1 participant