Skip to content

feat(atenlib): arange with overloads #285

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 9 commits into from
Jan 9, 2023
Merged

feat(atenlib): arange with overloads #285

merged 9 commits into from
Jan 9, 2023

Conversation

justinchuby
Copy link
Collaborator

@justinchuby justinchuby commented Jan 6, 2023

arange ops

@justinchuby justinchuby added the module: torchlib Related to the torch/aten function lib in development label Jan 6, 2023
@justinchuby justinchuby mentioned this pull request Jan 6, 2023
@codecov
Copy link

codecov bot commented Jan 6, 2023

Codecov Report

Merging #285 (0fba26f) into main (b635d24) will increase coverage by 0.08%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #285      +/-   ##
==========================================
+ Coverage   73.17%   73.26%   +0.08%     
==========================================
  Files          95       95              
  Lines        9144     9171      +27     
==========================================
+ Hits         6691     6719      +28     
+ Misses       2453     2452       -1     
Impacted Files Coverage Δ
onnxscript/function_libs/torch_aten/ops/core.py 60.75% <100.00%> (+0.78%) ⬆️
onnxscript/function_libs/torch_aten/typing.py 100.00% <100.00%> (ø)
...t/function_libs/torch_aten/ops_correctness_test.py 93.83% <100.00%> (+0.04%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@justinchuby justinchuby marked this pull request as draft January 6, 2023 00:41
def aten_arange_start(start: TReal, end: TReal, dtype: int = -1) -> TReal:
# arange.start(Scalar start, Scalar end, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor

if dtype != -1:
Copy link
Contributor

Choose a reason for hiding this comment

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

Since TReal has limited dtypes, what if the given dtype doesn't exist in the scope of TReal?

Should we set a default value it to dtype in case the given value of dtype is not in the scope of TReal?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. I am considering if I should cast after Range

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point. I am considering if I should cast after Range

If we pass start/end/step with an unexpected dtype into op.Range, will it work successfully?

Copy link
Collaborator Author

@justinchuby justinchuby Jan 8, 2023

Choose a reason for hiding this comment

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

Updated. It will work if dtype is specified. Otherwise they need to be casted before entering the function.

@justinchuby justinchuby marked this pull request as ready for review January 7, 2023 17:36
Copy link
Contributor

@fatcat-z fatcat-z left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@justinchuby justinchuby merged commit 9c75044 into main Jan 9, 2023
@justinchuby justinchuby deleted the justinchu/arange branch January 9, 2023 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: torchlib Related to the torch/aten function lib in development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants