-
Notifications
You must be signed in to change notification settings - Fork 4
take()
implementation
#96
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -768,7 +768,6 @@ def test_unique_axis_list(self): | |
assert_array_equal(unique(inp, axis=0), unique(inp_arr, axis=0), msg) | ||
assert_array_equal(unique(inp, axis=1), unique(inp_arr, axis=1), msg) | ||
|
||
@pytest.mark.xfail(reason='TODO: implement take') | ||
def test_unique_axis(self): | ||
types = [] | ||
types.extend(np.typecodes['AllInteger']) | ||
|
@@ -857,6 +856,15 @@ def _run_axis_tests(self, dtype): | |
result = np.array([[0, 0, 1], [0, 1, 0], [0, 0, 1], [0, 1, 0]]) | ||
assert_array_equal(unique(data, axis=1), result.astype(dtype), msg) | ||
|
||
pytest.xfail("torch has different unique ordering behaviour") | ||
# e.g. | ||
# | ||
# >>> x = np.array([[[1, 1], [0, 1]], [[1, 0], [0, 0]]]) | ||
# >>> np.unique(x, axis=2) | ||
# [[1, 1], [0, 1]], [[1, 0], [0, 0]] | ||
# >>> torch.unique(torch.as_tensor(x), dim=2) | ||
# [[1, 1], [1, 0]], [[0, 1], [0, 0]] | ||
# | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this something we need to fix in our unique? The Notes section in https://numpy.org/doc/stable/reference/generated/numpy.unique.html is probably relevant, if somewhat obscure. WDYT @lezcano ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Uf. This looks like a bit of a pain to implement. I'd say we don't touch it and leave it xfailed. |
||
msg = 'Unique with 3d array and axis=2 failed' | ||
data3d = np.array([[[1, 1], | ||
[1, 0]], | ||
|
Uh oh!
There was an error while loading. Please reload this page.