Title: [Bug]: call cmap object on torch.tensor will output first element all 0 · Issue #23132 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: call cmap object on torch.tensor will output first element all 0 · Issue #23132 · matplotlib/matplotlib
X Title: [Bug]: call cmap object on torch.tensor will output first element all 0 · Issue #23132 · matplotlib/matplotlib
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 pytor...
Open Graph 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 p...
X 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 p...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/23132
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: call cmap object on torch.tensor will output first element all 0","articleBody":"### Bug summary\n\nWhen 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.\n\n### Code for reproduction\n\n```python\nimport torch\r\nfrom matplotlib import cm\r\n\r\ncmap = cm.get_cmap(\"plasma\")\r\ni_tensor = abs(torch.randn([3,5,5]))\r\ni_tensor = i_tensor/i_tensor.max()\r\ni_numpy = i_tensor.numpy()\r\nc_ts = cmap(i_tensor)[...,:3]\r\nc_np = cmap(i_numpy)[...,:3]\r\nprint(c_ts[0])\r\nprint(c_np[0])\n```\n\n\n### Actual outcome\n\n[[[0. 0. 0.]\r\n [0. 0. 0.]\r\n [0. 0. 0.]\r\n [0. 0. 0.]\r\n [0. 0. 0.]]\r\n\r\n [[0. 0. 0.]\r\n [0. 0. 0.]\r\n [0. 0. 0.]\r\n [0. 0. 0.]\r\n [0. 0. 0.]]\r\n\r\n [[0. 0. 0.]\r\n [0. 0. 0.]\r\n [0. 0. 0.]\r\n [0. 0. 0.]\r\n [0. 0. 0.]]\r\n\r\n [[0. 0. 0.]\r\n [0. 0. 0.]\r\n [0. 0. 0.]\r\n [0. 0. 0.]\r\n [0. 0. 0.]]\r\n\r\n [[0. 0. 0.]\r\n [0. 0. 0.]\r\n [0. 0. 0.]\r\n [0. 0. 0.]\r\n [0. 0. 0.]]]\n\n### Expected outcome\n\nwith specific value\n\n### Additional information\n\n_No response_\n\n### Operating system\n\n_No response_\n\n### Matplotlib Version\n\n3.3.4\n\n### Matplotlib Backend\n\n_No response_\n\n### Python version\n\n_No response_\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\n_No response_","author":{"url":"https://github.com/yugeng-tju","@type":"Person","name":"yugeng-tju"},"datePublished":"2022-05-25T03:39:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/23132/matplotlib/issues/23132"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2b5db0d1-059c-f135-a7b6-4a5f70f44cb2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CAD8:1C38BA:4532E7:5C9A81:6A516DDC |
| html-safe-nonce | d60abff53110f3e3bf964edb830207ccc927d93aa24c6dc5f49f9de718e9919b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQUQ4OjFDMzhCQTo0NTMyRTc6NUM5QTgxOjZBNTE2RERDIiwidmlzaXRvcl9pZCI6IjIxODAxNDExMjUxMDg1OTIwOTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 681b0f0ad661ee27c533363abc93f73c2453fa5483751638d879ef48fb1c868d |
| hovercard-subject-tag | issue:1247423423 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/23132/issue_layout |
| twitter:image | https://opengraph.githubassets.com/328f8bbdaf2aee7a4c9700a42704a6658d27643b005722c85a727431e0a7274a/matplotlib/matplotlib/issues/23132 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/328f8bbdaf2aee7a4c9700a42704a6658d27643b005722c85a727431e0a7274a/matplotlib/matplotlib/issues/23132 |
| og:image:alt | 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 p... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | yugeng-tju |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 60eaaf6d4dbaa817031b556aebd8a0a7eeb81b97 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width