8000 Implement custom atleast_2d shape function by db091756 · Pull Request #697 · gchq/coreax · GitHub
[go: up one dir, main page]

Skip to content

Implement custom atleast_2d shape function #697

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

Merged
merged 7 commits into from
Jul 15, 2024
Merged

Conversation

db091756
Copy link
Member
@db091756 db091756 commented Jul 10, 2024

PR Type

  • Feature
  • Tests

Description

Implements a custom private version of jnp.atleast_2d that is the same except it converts 1-dimensional n-vectors to shape (n, 1) rather than (1, n).

There is a long history of discussion on the Numpy GitHub for implementing an atleast_nd function that would solve our issue here (see numpy/numpy#7804 & numpy/numpy#18386) but it doesn't seem very close to being merged, and in any case we would want to wait for a JAX implementation. I think we just solve our problem and maybe leave a note saying keep track of a JAX release that would change the behaviour of jnp.atleast_2d or implement a jnp.atleast_nd that we can use.

How Has This Been Tested?

Unit tests pass.

Does this PR introduce a breaking change?

(Write your answer here.)

Screenshots

(Write your answer here.)

Checklist before requesting a review

  • I have made sure that my PR is not a duplicate.
  • My code follows the style guidelines of this project.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have performed a self-review of my code.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • Any dependent changes have been merged and published in downstream modules.

@db091756 db091756 linked an issue Jul 10, 2024 that may be closed by this pull request
@db091756 db091756 self-assigned this Jul 10, 2024
@db091756 db091756 marked this pull request as ready for review July 10, 2024 09:15
Copy link
Contributor
@pc532627 pc532627 left a comment

Choose a reason for hiding this comment

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

These all look good to me, happy to merge

@pc532627 pc532627 merged commit 164130c into main Jul 15, 2024
22 checks passed
@pc532627 pc532627 deleted the feature/shape-handling branch July 15, 2024 08:55
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.

Change handling of JAX arrays, currently cast using atleast_2d
2 participants
0