Skip to content

include type promotion info in torch.add/mul/div documentation#27501

Merged
soumith merged 1 commit intopytorch:v1.3.0from
nairbv:v1.3_add_docfix
Oct 10, 2019
Merged

include type promotion info in torch.add/mul/div documentation#27501
soumith merged 1 commit intopytorch:v1.3.0from
nairbv:v1.3_add_docfix

Conversation

@nairbv
Copy link
Collaborator

@nairbv nairbv commented Oct 7, 2019

Related to #25114 but would like to improve torch.add doc on release branch.

Issue: #26825

FYI: @xuhdev

@nairbv nairbv requested review from gchanan and zou3519 October 7, 2019 21:37
@pytorchbot pytorchbot added the module: docs Related to our documentation, both in docs/ and docblocks label Oct 7, 2019
@nairbv nairbv mentioned this pull request Oct 7, 2019
@nairbv nairbv changed the title add type promotion info to torch.add documentation wip add type promotion info to torch.add documentation Oct 7, 2019
@nairbv nairbv changed the title wip add type promotion info to torch.add documentation include type promotion info in torch.add/mul/div documentation Oct 7, 2019
@nairbv nairbv requested a review from gchanan October 7, 2019 21:53
@zou3519
Copy link
Contributor

zou3519 commented Oct 7, 2019

I'm confused -- does this supercede #25114?

Copy link
Contributor

Choose a reason for hiding this comment

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

I want to point out that numpy makes no mention of type promotion in their doc: https://docs.scipy.org/doc/numpy/reference/generated/numpy.add.html

@xuhdev
Copy link
Collaborator

xuhdev commented Oct 7, 2019

I'm confused -- does this supercede #25114?

This PR is for the release branch. #25114 is for master

@nairbv nairbv requested a review from zou3519 October 8, 2019 17:01
@nairbv
Copy link
Collaborator Author

nairbv commented Oct 10, 2019

@pytorchbot retest this please

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.

sorry, getting to this late.

Args:
{input}
value (Number): the number to be added to each element of :attr:`input`
If the :class:`torch.dtype` of :attr:`input` and :attr:`other` differ,
Copy link
Contributor

Choose a reason for hiding this comment

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

does this "if" add anything? The the rules of type promotion apply even if the dtypes are the same, right?


If :attr:`input` is of type `FloatTensor` or `DoubleTensor`, :attr:`other`
should be a real number, otherwise it should be an integer
If the :class:`torch.dtype` of :attr:`input` and :attr:`other` differ,
Copy link
Contributor

Choose a reason for hiding this comment

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

same here.

If :attr:`input` is of type `FloatTensor` or `DoubleTensor`, :attr:`other`
should be a real number, otherwise it should be an integer

If the :class:`torch.dtype` of :attr:`input` and :attr:`other` differ,
Copy link
Contributor

Choose a reason for hiding this comment

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

same here.

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

Labels

module: docs Related to our documentation, both in docs/ and docblocks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants