-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Update Tensor doc #14339
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
Update Tensor doc #14339
Conversation
|
As expected clang tidy is not happy with the cast. |
|
Do a const_cast and that should shut clang tidy up. (I haven't verified if the cast is valid or not, but if you're sure you're right , that's what you should do) |
|
I do think the cast is valid here to the best of my knowledge: But I would like to wait for another opinion on this. |
|
The CI fail seems due to a division by 0 in Batchnorm1D test. So I guess unrelated to this PR? |
facebook-github-bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ezyang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
ezyang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okey dokey
Add to the Tensor doc info about
.device,.is_cuda,.requires_grad,.is_leafand.grad.Update the
register_backward_hookdoc with a warning stating that it does not work in all cases.Add support in the
_add_docstrfunction to add docstring to attributes.There is an explicit cast here but I am not sure how to handle it properly. The thing is that the doc field for getsetdescr is written as being a const char * (as all other doc fields in descriptors objects) in cpython online documentation. But in the code, it is the only one that is not const.
I assumed here that it is a bug in the code because it does not follow the doc and the convention of the others descriptors and so I cast out the const.
EDIT: the online doc I was looking at is for 3.7 and in that version both the code and the doc are const. For older versions, both are non const.
Please let me know if this should not be done. And if it should be done if there is a cleaner way to do it !