Skip to content

OpInfo: Added clamp and trunc tests with aliases#51167

Closed
vfdev-5 wants to merge 21 commits intopytorch:masterfrom
Quansight:port-more-aliases
Closed

OpInfo: Added clamp and trunc tests with aliases#51167
vfdev-5 wants to merge 21 commits intopytorch:masterfrom
Quansight:port-more-aliases

Conversation

@vfdev-5
Copy link
Copy Markdown
Contributor

@vfdev-5 vfdev-5 commented Jan 27, 2021

Description:

  • Added clamp, trunc tests with aliases
  • Added tests for aliases for asin(h), acos(h), etc
  • fixed 'fix' alias implementation
  • fixed annotations in test_jit_alias_remapping
  • updated native_functions.yaml aliases guidelines

Blocked by #50368

cc @mruberry

@facebook-github-bot
Copy link
Copy Markdown
Contributor

facebook-github-bot commented Jan 27, 2021

💊 CI failures summary and remediations

As of commit 37d9b64 (more details on the Dr. CI page):


  • 1/1 failures possibly* introduced in this PR
    • 1/1 non-CircleCI failure(s)

This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions to the (internal) Dr. CI Users group.

@mruberry
Copy link
Copy Markdown
Collaborator

This looks good. It should also cleanup the clamp metadata here:

('clamp', 'neg', _medium_2d, lambda t, d: [-1, 5], 1e-5, 1e-2, 1e-5, _signed_types, [torch.bfloat16]),

and the trunc metadata here:

('trunc', '', _small_3d, lambda t, d: [], 1e-5, 1e-2, 1e-5, _float_types, [torch.bfloat16]),

and here:

('trunc', (S, S, S), NO_ARGS, '', (True,)),

@mruberry
Copy link
Copy Markdown
Collaborator

Most test failures are in base and should be fixed if this rebases. The clamp failures like this are real, though:

test_batch_vs_slicing_clamp_cpu_int16 - TestUnaryUfuncsCPU
test_unary_ufuncs.py

Traceback (most recent call last):
  File "/Users/distiller/workspace/miniconda3/lib/python3.7/site-packages/torch/testing/_internal/common_device_type.py", line 295, in instantiated_test
    raise rte
  File "/Users/distiller/workspace/miniconda3/lib/python3.7/site-packages/torch/testing/_internal/common_device_type.py", line 290, in instantiated_test
    result = test_fn(self, *args)
  File "/Users/distiller/workspace/miniconda3/lib/python3.7/site-packages/torch/testing/_internal/common_device_type.py", line 268, in test_wrapper
    return test(*args, **kwargs)
  File "test_unary_ufuncs.py", line 400, in test_batch_vs_slicing
    actual = op(input)
  File "/Users/distiller/workspace/miniconda3/lib/python3.7/site-packages/torch/testing/_internal/common_methods_invocations.py", line 217, in __call__
    return self.op(*args, **kwargs)
RuntimeError: At least one of 'min' or 'max' must not be None

Should be an easy fix.

@mruberry
Copy link
Copy Markdown
Collaborator

And these can be removed, too:

_TorchMathTestMeta('trunc'),

_TorchMathTestMeta('abs', input_fn=_medium_2d, dtypes=_types_no_half, rtol=0., atol=0.),

vfdev-5 and others added 2 commits January 27, 2021 22:35
- fixed 'fix' alias implementation
- fixed annotations in test_jit_alias_remapping
@ailzhang ailzhang requested a review from mruberry January 29, 2021 04:10
@ailzhang ailzhang added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Jan 29, 2021
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 2, 2021

Codecov Report

Merging #51167 (37d9b64) into master (8f0968f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master   #51167   +/-   ##
=======================================
  Coverage   80.87%   80.87%           
=======================================
  Files        1943     1943           
  Lines      211510   211520   +10     
=======================================
+ Hits       171056   171075   +19     
+ Misses      40454    40445    -9     

Comment thread torch/testing/_internal/common_methods_invocations.py
Comment thread torch/testing/_internal/common_methods_invocations.py
Comment thread test/test_ops.py
@mruberry
Copy link
Copy Markdown
Collaborator

mruberry commented Feb 3, 2021

Looking good, @vfdev-5, I made just a few comments inline!

vfdev-5 added 2 commits February 3, 2021 05:22
- added code explanation
- more inputs for clamp
@mruberry mruberry self-requested a review February 4, 2021 04:50
Copy link
Copy Markdown
Collaborator

@mruberry mruberry left a comment

Choose a reason for hiding this comment

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

Great attention to detail, removal of legacy tests, and an awesome fix for fix! Thanks @vfdev-5!

Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@mruberry has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@vfdev-5 vfdev-5 deleted the port-more-aliases branch February 10, 2021 14:05
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@mruberry merged this pull request in 8b0cb5e.

xsacha pushed a commit to xsacha/pytorch that referenced this pull request Mar 31, 2021
Summary:
Description:
- Added clamp, trunc tests with aliases
- Added tests for aliases for asin(h), acos(h), etc
- fixed 'fix' alias implementation
- fixed annotations in test_jit_alias_remapping
- updated native_functions.yaml aliases guidelines

Blocked by pytorch#50368

cc mruberry

Pull Request resolved: pytorch#51167

Reviewed By: gchanan

Differential Revision: D26245753

Pulled By: mruberry

fbshipit-source-id: e17b657f0515139735a8a677b1ae284904f98aef
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Summary:
Description:
- Added clamp, trunc tests with aliases
- Added tests for aliases for asin(h), acos(h), etc
- fixed 'fix' alias implementation
- fixed annotations in test_jit_alias_remapping
- updated native_functions.yaml aliases guidelines

Blocked by pytorch#50368

cc mruberry

Pull Request resolved: pytorch#51167

Reviewed By: gchanan

Differential Revision: D26245753

Pulled By: mruberry

fbshipit-source-id: e17b657f0515139735a8a677b1ae284904f98aef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed Merged open source triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants