Skip to content

Conversation

@mruberry
Copy link
Collaborator

@mruberry mruberry commented Aug 20, 2020

These aliases are consistent with NumPy (see, for example, https://numpy.org/doc/stable/reference/generated/numpy.arccos.html?highlight=acos).

Note that PyTorch's existing names are consistent with Python (see https://docs.python.org/3.10/library/math.html?highlight=acos#math.acos) and C++ (see, for example, https://en.cppreference.com/w/cpp/numeric/math/acos).

Mike Ruberry added 2 commits August 19, 2020 22:49
@mruberry mruberry requested a review from apaszke as a code owner August 20, 2020 05:54
@mruberry mruberry added the module: numpy Related to numpy support, and also numpy compatibility of our operators label Aug 20, 2020
@mruberry mruberry removed the request for review from apaszke August 20, 2020 05:54
@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Aug 20, 2020
@dr-ci
Copy link

dr-ci bot commented Aug 20, 2020

💊 CI failures summary and remediations

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


💚 💚 Looks good so far! There are no failures yet. 💚 💚


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 on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 3 times.

@mruberry mruberry requested a review from gchanan August 20, 2020 10:57
{aten::arccosh, aten::acosh},
{aten::arccosh_, aten::acosh_}};
{aten::arccosh_, aten::acosh_},
{aten::arccos, aten::acos_},
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be the non-inplace variant?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep. Good catch.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also: let's elaborate the test to catch errors like this just in case they occur again.

Copy link
Contributor

@gchanan gchanan left a comment

Choose a reason for hiding this comment

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

looks good once JIT issue is addressed.

Copy link
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.

@facebook-github-bot
Copy link
Contributor

@mruberry merged this pull request in e57b89c.

@mruberry mruberry deleted the arc_aliases branch August 21, 2020 19:42
@vfdev-5
Copy link
Contributor

vfdev-5 commented Aug 28, 2020

@mruberry I wonder why arc* alias methods are defined here as

// arcsin, alias of asin
Tensor& arcsin_out(Tensor& result, const Tensor& self) { return unary_op_impl_out(result, self, asin_stub); }
Tensor arcsin(const Tensor& self) { return unary_op_impl(self, at::asin_out); }
Tensor& arcsin_(Tensor& self) { return unary_op_impl_(self, at::asin_out); }

using unary_op_impl vs, for example, clip

// Implements the "clip" alias for clamp
Tensor& clip_out(Tensor& result, const Tensor& self, optional<Scalar> min, optional<Scalar> max) {
  return at::clamp_out(result, self, min, max);
}
Tensor clip(const Tensor& self, optional<Scalar> min, optional<Scalar> max) {
  return at::clamp(self, min, max);
}
Tensor& clip_(Tensor& self, optional<Scalar> min, optional<Scalar> max) {
  return at::clamp_(self, min, max);
}

thanks !

Context:
I have an issue with dispatching on arcsin.out which does not dispatch as asin.out...

@mruberry
Copy link
Collaborator Author

@mruberry I wonder why arc* alias methods are defined here as

// arcsin, alias of asin
Tensor& arcsin_out(Tensor& result, const Tensor& self) { return unary_op_impl_out(result, self, asin_stub); }
Tensor arcsin(const Tensor& self) { return unary_op_impl(self, at::asin_out); }
Tensor& arcsin_(Tensor& self) { return unary_op_impl_(self, at::asin_out); }

using unary_op_impl vs, for example, clip

// Implements the "clip" alias for clamp
Tensor& clip_out(Tensor& result, const Tensor& self, optional<Scalar> min, optional<Scalar> max) {
  return at::clamp_out(result, self, min, max);
}
Tensor clip(const Tensor& self, optional<Scalar> min, optional<Scalar> max) {
  return at::clamp(self, min, max);
}
Tensor& clip_(Tensor& self, optional<Scalar> min, optional<Scalar> max) {
  return at::clamp_(self, min, max);
}

thanks !

Context:
I have an issue with dispatching on arcsin.out which does not dispatch as asin.out...

Hey @vfdev-5, sorry to hear you're hitting an issue. I agree having them just immediately call the asin functions would be simpler. I'll put up a PR for that now.

@vfdev-5
Copy link
Contributor

vfdev-5 commented Aug 28, 2020

@mruberry thanks ! Otherwise I can also send a PR with the fix if you want...

@mruberry
Copy link
Collaborator Author

@mruberry thanks ! Otherwise I can also send a PR with the fix if you want...

Thank you but I rolled the update into a PR adding a couple more aliases. See #43762. It should land soon.

@mruberry
Copy link
Collaborator Author

Should be OK now, @vfdev-5 -- let me know.

@vfdev-5
Copy link
Contributor

vfdev-5 commented Aug 29, 2020

@mruberry thanks for the PR, it fixes my issue !

@mruberry
Copy link
Collaborator Author

@mruberry thanks for the PR, it fixes my issue !

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged module: numpy Related to numpy support, and also numpy compatibility of our operators oncall: jit Add this issue/PR to JIT oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants