-
Notifications
You must be signed in to change notification settings - Fork 27.4k
[numpy compat] Tensor incompatible with numpy.random.shuffle #50880
Copy link
Copy link
Closed
Labels
module: numpyRelated to numpy support, and also numpy compatibility of our operatorsRelated 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 moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
🐛 Bug
Numpy wont correctly shuffle a torch tensor.
To Reproduce
In [23]: import torch as th
In [24]: import numpy as np
In [25]: x = th.arange(10)
In [26]: x
Out[26]: tensor([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
In [27]: np.random.shuffle(x)
In [28]: x
Out[28]: tensor([0, 1, 2, 3, 4, 5, 0, 4, 8, 2])There are duplicated items in the shuffled result, which is clearly incorrect.
Environment
In [29]: np.__version__
Out[29]: '1.18.5'
In [30]: th.__version__
Out[30]: '1.7.0'
- PyTorch Version (e.g., 1.0): 1.7.0
- OS (e.g., Linux): Linux (debian unstable)
- How you installed PyTorch (
conda,pip, source): conda - Build command you used (if compiling from source): N/A
- Python version: 3.8.3
- CUDA/cuDNN version:
- GPU models and configuration:
- Any other relevant information:
Additional context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
module: numpyRelated to numpy support, and also numpy compatibility of our operatorsRelated 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 moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module