WARNING: Inappropriate Slice
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 65/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- numpy, python
- Domain
- machine-learning
Research direction
Start with data_loader.py around line 150 and reproduce the one-hot encoding behavior under Python 3.11 with NumPy 1.26, comparing it with the older environment described. Verify that the resulting one-hot values are set only for the intended indices and that the reported inappropriate slicing no longer sets all values to 1.
Written by the indexing model from the issue text.
Description
Thank you for your great work. However, when I ran the current code under python 3.11 and numpy 1.26, I got a very bad result. The magic is that when I run in another lower version (i.e. python 3.7 and numpy 1.21), the results are as expected.
I checked the code carefully and found that there was a problem on line 150 of data_loader.py:
"result[list(np.indices(arr.shape)) + [arr]] = 1"
This is because when doing one-hot encoding, the current code uses inappropriate slicing, which causes all one-hot encoding values to be set to 1 in the newer environment.
I recommend making the following changes to line 150 of data_loader.py:
"result[np.indices(arr.shape), np.array(arr)] = 1"
Unfortunately, I was not aware of this problem before, which resulted in an error in a previous job :(
- Dominant language
- Python
- Stars
- 221
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from CSAILVision/NetDissect-Lite
-
Difficulty 3/5 1-2 days Newbie friendliness 32/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Import issue Open
Difficulty 3/5 1-2 days Newbie friendliness 25/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
CSAILVision/NetDissect-Lite#23 · 3 reactions ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 30/100
CSAILVision/NetDissect-Lite#22 · 1 comment ·
All issues in CSAILVision/NetDissect-Lite
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100