Land "Make ceil,floor,round,trunc handle integers" (#85144)

PR to land https://github.com/pytorch/pytorch/pull/78480, as Rohit does
not work in the PyTorch project anymore
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85144
Approved by: https://github.com/ngimel, https://github.com/mruberry
This commit is contained in:
lezcano
2022-09-21 08:14:48 +00:00
committed by PyTorch MergeBot
parent 6f2b390fc1
commit 2a88f1b2d8
7 changed files with 111 additions and 28 deletions

View File

@ -2327,6 +2327,9 @@ ceil(input, *, out=None) -> Tensor
Returns a new tensor with the ceil of the elements of :attr:`input`,
the smallest integer greater than or equal to each element.
For integer inputs, follows the array-api convention of returning a
copy of the input tensor.
.. math::
\text{out}_{i} = \left\lceil \text{input}_{i} \right\rceil
"""
@ -4164,6 +4167,9 @@ floor(input, *, out=None) -> Tensor
Returns a new tensor with the floor of the elements of :attr:`input`,
the largest integer less than or equal to each element.
For integer inputs, follows the array-api convention of returning a
copy of the input tensor.
.. math::
\text{out}_{i} = \left\lfloor \text{input}_{i} \right\rfloor
"""
@ -9631,6 +9637,9 @@ round(input, *, decimals=0, out=None) -> Tensor
Rounds elements of :attr:`input` to the nearest integer.
For integer inputs, follows the array-api convention of returning a
copy of the input tensor.
.. note::
This function implements the "round half to even" to
break ties when a number is equidistant from two
@ -12010,6 +12019,9 @@ trunc(input, *, out=None) -> Tensor
Returns a new tensor with the truncated integer values of
the elements of :attr:`input`.
For integer inputs, follows the array-api convention of returning a
copy of the input tensor.
Args:
{input}