Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Labels
Milestone
Description
Bug summary
When I create camp object and call on torch.tensor, it output result with first element be all 0. But if I call tensor.numpy() explicity, everything went well. I do not know this is a problem of matplotlib or problem of pytorch.
Code for reproduction
importtorchfrommatplotlibimportcmcmap=cm.get_cmap("plasma")i_tensor=abs(torch.randn([3,5,5]))i_tensor=i_tensor/i_tensor.max()i_numpy=i_tensor.numpy()c_ts=cmap(i_tensor)[...,:3]c_np=cmap(i_numpy)[...,:3]print(c_ts[0])print(c_np[0])
Actual outcome
[[[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]]
[[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]]
[[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]]
[[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]]
[[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]]]
Expected outcome
with specific value
Additional information
No response
Operating system
No response
Matplotlib Version
3.3.4
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
No response