-
Notifications
You must be signed in to change notification settings - Fork 23.3k
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
Fix empty tensor for unique_dim #19000
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @codexetreme, could you please complete this PR first, i.e. to add unit test, and do the same check for GPU? By adding unit test, you could basically find problem by yourself, and change it without having to ask help. The error messages in circle CI should be fairly helpful. Also, please resolve merge conflicts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have fixed merge conflicts, the other irregularities you mentioned. Also I am having a bit of difficulty writing tests. Where are these supposed to go exactly? there are many test folders. Should I add the tests in test_torch.py
or in some other test folder?
@codexetreme Sorry for the late reply, yes, for the test, you need to write it at |
BTW, I am working on unique also, so some of my work might frequently cause merge conflicts for this. You might also continue your work, and resolve the conflicts later, which might be of less trouble. It's your choice. |
@codexetreme Also, whenever you see build failures from CI, could you also please check where is error and try fixing it? :) |
Alright, I am looking into the CI logs... I'll write the tests and try to fix the CI bugs.
I will do this... |
So in some of the CI logs, the error that is said is :
Does this mean that the containers have not been properly instantiated or that the code in the commit is broken? And what to do for these? |
@codexetreme For these kind of failures, you could do a "@pytorchbot retest this please" |
@pytorchbot retest this please |
@codexetreme The bot is currently broken. You may try again next week. |
@pytorchbot retest this please |
The same issue persists with the tests. What should be done ? |
@codexetreme I think you need to resolve the conflict and merge with the latest master branch now. They must have updated CircleCI configurations. |
Sorry for the late reply (uni assignments take up time :( ). Could you tell me the use of the |
@codexetreme Yes |
In the
a simple fix is to just rename its usages here, since I dont see these particular lines being used elsewhere.
|
So, I have made the changes you requested, I changed the logic so now it handles the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks much better now. Could you please also fix the linter failures in Travis CI?
./test/test_torch.py:10963:17: E128 continuation line under-indented for visual indent
./test/test_torch.py:10964:17: E128 continuation line under-indented for visual indent
./test/test_torch.py:10965:17: E128 continuation line under-indented for visual indent
./test/test_torch.py:10966:17: E128 continuation line under-indented for visual indent
./test/test_torch.py:10969:17: E128 continuation line under-indented for visual indent
./test/test_torch.py:10970:17: E128 continuation line under-indented for visual indent
./test/test_torch.py:10971:17: E128 continuation line under-indented for visual indent
./test/test_torch.py:10972:17: E128 continuation line under-indented for visual indent
The command "flake8" exited with 1.
Ok, so I have fixed the linting, what to do next? |
Why is that 1 particular test failing? The other cuda based tests seem to have passed... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codexetreme That failure is not your fault, just ignore it. The code LGTM now. @VitalyFedyunin Could you please take a look and merge?
When will this be merged? Kinda curious ..... |
@pytorchbot rebase this please |
kindly ping @VitalyFedyunin :) Could you please take a look at this? This does not have API change and should be easy to review. |
Sure, I was hoping to have #20017 fixed (this helps to write tests quickly), guess I will do workaround. |
aten/src/ATen/native/Unique.cpp
Outdated
// check how many zero dimentions exist | ||
auto num_zero_dims = std::count(sizes.begin(), sizes.end(), 0); | ||
|
||
// tensor is not well formed as it has 0 sized dimentions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: dimenSions, here and everywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed this :)
test/test_torch.py
Outdated
|
||
# test not a well formed tensor | ||
# Checking for runtime error, as this is the expected behaviour | ||
self.assertRaises( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: It is cleaner to write
with self.assertRaises(RuntimeError):
torch.unique(
x_ill_formed_empty,
return_inverse=True,
return_counts=True,
dim=1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have made the change like suggested :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VitalyFedyunin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Could you please cleanup training whitespaces |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VitalyFedyunin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: Fixes: #18408 cc: zasdfgbnm Pull Request resolved: pytorch/pytorch#19000 Reviewed By: ezyang Differential Revision: D15470136 Pulled By: VitalyFedyunin fbshipit-source-id: daf71566b4dbdc91927d164f813b5ee8645af1a2
@VitalyFedyunin merged this pull request in 0ffd20c. |
Fixes: #18408
cc: @zasdfgbnm