FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Support numpy size() and array.size by ubaidsk · Pull Request #1777 · lcompilers/lpython · GitHub

Support numpy size() and array.size - #1777

Merged
certik merged 4 commits into
lcompilers:mainfrom
ubaidsk:numpy_size
May 11, 2023
Merged

Support numpy size() and array.size#1777
certik merged 4 commits into
lcompilers:mainfrom
ubaidsk:numpy_size

Conversation

ubaidsk commented May 11, 2023

Copy link
Copy Markdown
Collaborator

fixes #1773

ubaidsk marked this pull request as draft May 11, 2023 00:26
ubaidsk changed the title Support numpy array.size Support numpy size and array.size May 11, 2023
ubaidsk marked this pull request as ready for review May 11, 2023 00:58
ubaidsk requested a review from certik May 11, 2023 00:58
ubaidsk changed the title Support numpy size and array.size Support numpy size() and array.size May 11, 2023

ubaidsk commented May 11, 2023

Copy link
Copy Markdown
Collaborator Author

This is ready.

certik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thank you! This PR is good to merge.

Since we are doing it, in a new PR can you also please add a test like:

from numpy import size
a = empty((2, 3))
assert size(a) == 2*3
assert size(a, 0) == 2
assert size(a, 1) == 3

It will probably already work, but just in case. I usually use the size function like this, just like in Fortran.

certik merged commit ff38f75 into lcompilers:main May 11, 2023
ubaidsk deleted the numpy_size branch May 11, 2023 14:36

ubaidsk commented May 11, 2023

Copy link
Copy Markdown
Collaborator Author

Since we are doing it, in a new PR can you also please add a test like:

Sure, thank you for the guidance. It seems the backends expect dimension value to start from 1, where as the axis attribute of numpy size() starts from 0. I fixed it by adding a constant 1 to the user provided dimension and added the test case in #1780.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement numpy.size()

2 participants


Back | FazBrowse Home | New Git URL