Skip to content
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

Add instance methods tensor.isnan(), tensor.isinf(), tensor.isfinite() #37942

Closed
wants to merge 1 commit into from

Conversation

ShawnZhong
Copy link
Contributor

@ShawnZhong ShawnZhong commented May 6, 2020

Fix #37736

@ShawnZhong ShawnZhong marked this pull request as ready for review May 6, 2020 18:26
@dr-ci
Copy link

dr-ci bot commented May 6, 2020

💊 CI failures summary and remediations

As of commit 341fb19 (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.

See how this bot performed.

This comment has been revised 9 times.

@choidongyeon
Copy link

Hey @ShawnZhong, could you help me understand how this PR fixes the issue? Just curious 😄

@ShawnZhong
Copy link
Contributor Author

@choidongyeon

### `variants`
```
variants: function, method
```
Controls whether Tensor method (`t.foo()`) or namespace Function (`at::foo()`) is
generated as a result of this declaration. If the declaration is a method,
you must have an argument `Tensor self` at some position in the method;
in the method variant this argument will be elided from the argument
list. For example, given the declaration `where(BoolTensor cond, Tensor self, Tensor other)`,
this generates the function `at::where(cond, self, other)` and the method
`self.where(cond, other)`.
By default, ATen generates only the function variant for a native function.
When should you also generate a method variant? Tensor operations as methods
are appropriate for "core" Tensor operations (e.g., add, sub, etc.), but not for
more complicated neural network layers (e.g., `conv2d`) and internal functions
designed specifically for binding (e.g., `cudnn_convolution`).
As we progress along our schema unification of the `func` schema with the JIT
signature schema, we must introduce features that allow us to increase compliance.
One of these features are Tensor annotations. As of now we use naming conventions
to indicate whether an argument of a function is going to be mutated and returned.

Update _tensor_docs.py

Update tensors.rst

Update _tensor_docs.py
@ShawnZhong
Copy link
Contributor Author

Since this PR has been around for a while, is there anyone who'd like to review this PR?

@gchanan @soumith

Copy link
Member

@soumith soumith left a comment

Choose a reason for hiding this comment

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

lgtm

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.

@soumith is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@ShawnZhong ShawnZhong deleted the instance_methods branch May 11, 2020 22:58
@facebook-github-bot
Copy link
Contributor

@soumith merged this pull request in 5f9b903.

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

Successfully merging this pull request may close these issues.

[discussion] Add convenience instance methods tensor.isnan(), tensor.isinf(), tensor.isfinite()
6 participants