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

Added support for numpy NDarray method. Added corresponding tests #135

Closed
wants to merge 7 commits into from

Conversation

LakeBlair
Copy link
Contributor

Overview

After some investigations into #118 , I optimized the code and added unit testing in function_codegen.py, added test in regression_test.py, and added an example in example.py

Details

image
image
image
image

Reference

#78

Blocked By

@LakeBlair LakeBlair requested a review from odashi as a code owner November 24, 2022 22:17
@google-cla
Copy link

google-cla bot commented Nov 24, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Collaborator

@odashi odashi left a comment

Choose a reason for hiding this comment

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

This pull request need to wait for #118

{
"data": {
"text/latex": [
"$$ \\displaystyle \\mathrm{numpy}(a) = \\begin{bmatrix} {1} & {2} & {3} & {4} \\\\ {5} & {6} & {7} & {8} \\\\ {9} & {10} & {11} & {12} \\end{bmatrix} $$"
Copy link
Collaborator

Choose a reason for hiding this comment

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

The function name "numpy" is weird as it may overrides the package name (in some cases). Something else (e.g., myarray) is preferred.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@odashi I renamed function into myNdarray.

}
],
"metadata": {
"kernelspec": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove unnecessary metadata.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed kernelspec from metadata.

@@ -3,6 +3,7 @@
from __future__ import annotations

import math
import numpy as np
Copy link
Collaborator

Choose a reason for hiding this comment

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

This import requires additional dev dependency in pyproject.toml.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Odashi, I added numpy version in pyproject.toml, let me know if the version is suitable for the project.

@@ -4,7 +4,7 @@

import ast
import textwrap

import numpy as np
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unused.

Suggested change
import numpy as np

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed numpy import from function_codegen_test.py

@LakeBlair
Copy link
Contributor Author

This pull request need to wait for #118

Sounds good Odashi. I added tests in both codegen_test.py and regression_test.py. Let me know if they fit into the existing style of testing as this is my first time contributing to this project.

@odashi
Copy link
Collaborator

odashi commented Dec 5, 2022

@LakeBlair Now #143 (follow-up of #118) was merged, could you update this pull request to follow the recent changes?

@LakeBlair
Copy link
Contributor Author

@LakeBlair Now #143 (follow-up of #118) was merged, could you update this pull request to follow the recent changes?

@odashi I took a look at #143 and it seems that it handled ndarray and have corresponding test cases. I am not sure what more to add on this PR?

@odashi
Copy link
Collaborator

odashi commented Dec 6, 2022

@LakeBlair Oh yeah, I checked this PR again, and I guessed this is no longer necessary. So it'll be better to be closed anyway. Sorry for bothoring, but thanks for your contribution!

@odashi odashi closed this Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants