Skip to content

Update doc for add and mul for master, following #27501.#28118

Closed
xuhdev wants to merge 1 commit intopytorch:masterfrom
xuhdev:add-doc
Closed

Update doc for add and mul for master, following #27501.#28118
xuhdev wants to merge 1 commit intopytorch:masterfrom
xuhdev:add-doc

Conversation

@xuhdev
Copy link
Collaborator

@xuhdev xuhdev commented Oct 16, 2019

This is the master version (with format updates) of #27571

Superseding #25114

cc @nairbv @gchanan

@nairbv
Copy link
Collaborator

nairbv commented Oct 17, 2019

Note: This PR changes add/sub/mul but not div. Div was in a separate PR:
#25968

Copy link
Collaborator

@nairbv nairbv left a comment

Choose a reason for hiding this comment

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

failing doc-related test:

Traceback (most recent call last):
Oct 17 00:53:24   File "test_docs_coverage.py", line 77, in test_torch
Oct 17 00:53:24     don't want to document?''')
Oct 17 00:53:24 AssertionError: 
Oct 17 00:53:24 The lists of functions documented in torch.rst and in python are different.
Oct 17 00:53:24 Did you forget to add a new thing to torch.rst, or whitelist things you
Oct 17 00:53:24 don't want to document?

Copy link
Collaborator

@nairbv nairbv left a comment

Choose a reason for hiding this comment

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

looks like this still has valid test failures?

FAIL: test_doc_examples (main.TestTypeHints)

@xuhdev
Copy link
Collaborator Author

xuhdev commented Oct 21, 2019

looks like this still has valid test failures?

FAIL: test_doc_examples (main.TestTypeHints)

Looks like add and sub should no longer be an exception when generating type hints. I've removed them from the exception list and the type hint tests can pass now.

@xuhdev xuhdev requested a review from nairbv October 21, 2019 18:57
@xuhdev xuhdev added module: docs Related to our documentation, both in docs/ and docblocks module: operators labels Oct 24, 2019
@xuhdev
Copy link
Collaborator Author

xuhdev commented Oct 24, 2019

@nairbv My experiment shows that, when I call torch.add(a, 2) (where a=torch.ones(10)), the entry seems to be

Tensor add(const Tensor& self, const Tensor& other, Scalar alpha)

That means, the following scalar version function is not called:

Tensor add(const Tensor& self, Scalar other, Scalar alpha)

But torch.pow(a, 2) will call the scalar version of pow:

Tensor pow(const Tensor& base, Scalar exp)

Do you have any idea why this is happening?

@nairbv
Copy link
Collaborator

nairbv commented Oct 24, 2019

@nairbv My experiment shows that, when I call torch.add(a, 2) (where a=torch.ones(10)), the entry seems to be

Tensor add(const Tensor& self, const Tensor& other, Scalar alpha)

That means, the following scalar version function is not called:

Tensor add(const Tensor& self, Scalar other, Scalar alpha)

But torch.pow(a, 2) will call the scalar version of pow:

Tensor pow(const Tensor& base, Scalar exp)

Do you have any idea why this is happening?

It's confusing, but I'm guessing it's related to the deprecated function add(Tensor self, Scalar alpha, Tensor other)

see ./tools/autograd/deprecated.yaml

e.g. here I can make it complain about 'alpha' when it's the second arg that's floating point:

>>> torch.add(2, 1.5, 1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: For integral input tensors, argument alpha must not be a floating point number.

@xuhdev
Copy link
Collaborator Author

xuhdev commented Oct 24, 2019

I've got an answer from @ailzhang , sort of make sense to me: #28534 (comment)

@xuhdev
Copy link
Collaborator Author

xuhdev commented Nov 5, 2019

The CI failure is blocked by #29238

@ezyang ezyang added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Feb 3, 2020
@gchanan gchanan removed their request for review June 3, 2020 15:51
@facebook-github-bot
Copy link
Contributor

Hi @xuhdev!

Thank you for your pull request. We require contributors to sign our Contributor License Agreement, and yours needs attention.

You currently have a record in our system, but we do not have a signature on file.

In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@pytorchbot
Copy link
Collaborator

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
If you are unable to remove the Stale label please contact a maintainer in order to do so.
Stale pull requests will automatically be closed 30 days after being marked Stale

@pytorchbot pytorchbot added Stale and removed Stale labels Apr 12, 2022
@github-actions
Copy link
Contributor

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
If you are unable to remove the Stale label please contact a maintainer in order to do so.
If you want the bot to never mark this PR stale again, add the no-stale label.
Stale pull requests will automatically be closed after 30 days of inactivity.

@github-actions github-actions bot added the Stale label Jun 11, 2022
@github-actions github-actions bot closed this Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed module: docs Related to our documentation, both in docs/ and docblocks open source Stale 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.

6 participants