Skip to content

Fix: Add dtype to empty_like function - #4037

Closed
JasonHonKL wants to merge 8 commits into
ml-explore:mainfrom
JasonHonKL:isse-4001
Closed

Fix: Add dtype to empty_like function#4037
JasonHonKL wants to merge 8 commits into
ml-explore:mainfrom
JasonHonKL:isse-4001

Conversation

@JasonHonKL

@JasonHonKL JasonHonKL commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

(Please merge previous PR) @reckylurker
Fix #4001

Update

Added test with the empty_like function. Remove public APIs of empty like.

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the necessary documentation (if needed)

@zcbenz zcbenz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you make the C++ zeros_like take additional dtype while keeping empty_like unchanged as an alias? Also we prefer hiding empty/empty_like from public APIs as we don't want to have multiple APIs doing the same thing.

@JasonHonKL

Copy link
Copy Markdown
Contributor Author

@zcbenz Sure no problem.

@JasonHonKL
JasonHonKL requested a review from zcbenz August 7, 2026 04:20
@JasonHonKL

JasonHonKL commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@zcbenz Removed the public APIs. Since at the beginning zero_likes is the same as empty_like, and zero_likes is updated, this PR just adds tests to verify empty_like. Thanks for the reminder !

@zcbenz

zcbenz commented Aug 7, 2026

Copy link
Copy Markdown
Member

Ah sorry I forgot #4028 just updated the zeros_like. Since empty_like is a trivial alias of zeros_like we don't really need to add more tests, so I'm closing this PR.

@zcbenz zcbenz closed this Aug 7, 2026
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.

Adding dtype parameter to creation methods like the zeroes_like and ones_like

3 participants