Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Bug]: call cmap object on torch.tensor will output first element all 0 #23132

Closed
@SanGilbert

Description

@SanGilbert

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp