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

torch.Tensor.sort return type values access PD011 false positive #135

Open
ringohoffman opened this issue Feb 3, 2024 · 1 comment
Open

Comments

@ringohoffman
Copy link

Describe the bug
I am getting a PD011 warning about accessing the values attribute of the torch.Tensor.sort return type NamedTuple.

To Reproduce

[tool.ruff.lint]
select = [
    'PD',  # pandas-vet
]
$ ruff --version
ruff 0.1.14
$ python -c "import torch; print(torch.__version__)"
2.2.0
$ ruff check a.py
import torch

def func(tensor: torch.Tensor) -> torch.Tensor:
    flattened_tensor = tensor.view(-1)
    return flattened_tensor.sort(dim=-3).values[:, :, 10]  # PD011 Use `.to_numpy()` instead of `.values`

Expected behavior
This is not a pandas object, I don't expect to receive pandas warnings about it.

@sbrugman
Copy link

sbrugman commented Sep 9, 2024

For posterity: this is a false positive in ruff, not in this project and should be placed on that project's issue tracker. (Ruff reimplemented the rules in rust)

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