Skip to content
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

Enhance mask_indices and move_axis #622

Merged

Conversation

robinwnv
Copy link
Contributor

No description provided.

@robinwnv robinwnv added the category:task PR is a simple task and will not be included in release notes label Sep 29, 2022
Copy link
Contributor

@bryevdv bryevdv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are very nice, only a few small comments

Comment on lines 21 to 22
KS = [0, -1, 1, -2, 2]
FUNCTIONS = ["tril", "triu"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer tuples unless mutability is an explicit need

Suggested change
KS = [0, -1, 1, -2, 2]
FUNCTIONS = ["tril", "triu"]
KS = (0, -1, 1, -2, 2)
FUNCTIONS = ("tril", "triu")

(here, and also several places below)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. Tuple is better than list if the case is immutable. Fixed.

Comment on lines 59 to 63
EMPTY_ARRAYS = [
[],
[[]],
[[], []],
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
EMPTY_ARRAYS = [
[],
[[]],
[[], []],
]
EMPTY_ARRAYS = (
[],
[[]],
[[], []],
)


msg = "'str' object is not callable"
with pytest.raises(TypeError, match=msg):
num.mask_indices(10, "abc")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be better split into two separate named tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

cn.moveaxis(self.x, None, 0)

with pytest.raises(TypeError, match=msg):
cn.moveaxis(self.x, 0, None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

split into separate tests for float and None

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@robinwnv robinwnv merged commit 26ef5b9 into nv-legate:branch-22.10 Sep 30, 2022
@robinwnv robinwnv deleted the enhance_maskindices_moveaxis branch March 14, 2023 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:task PR is a simple task and will not be included in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants