Skip to content

Support torch.where(condition) as an alias for NumPy-like nonzero #21798

@colesbury

Description

@colesbury

🚀 Feature

Implement torch.where(condition) as an alias for a NumPy-like nonzero. Currently, we only support torch.where(condition, x, y) with the second and third arguments.

Motivation

NumPy supports numpy.where(condition) without the x and y arguments. It's behaves like numpy.nonzero.

https://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html

Pitch

Maybe @alexpeys will stop bugging me if you implement this

Alternatives

Move @alexpeys's desk farther away

Metadata

Metadata

Assignees

Labels

featureA request for a proper, new feature.module: numpyRelated to numpy support, and also numpy compatibility of our operatorstriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions