Skip to content

Commit

Permalink
corrected indent in docs for modf, minor formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
coquelin77 committed Dec 6, 2019
1 parent 8bd1ae7 commit cfa1f74
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 29 deletions.
2 changes: 0 additions & 2 deletions heat/core/dndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -2303,7 +2303,6 @@ def __rmod__(self, other):
>>> T = ht.int32([1, 3])
>>> 2 % T
tensor([0, 2], dtype=torch.int32)
"""
return arithmetics.mod(other, self)

Expand Down Expand Up @@ -2331,7 +2330,6 @@ def round(x, decimals=0, out=None, dtype=None):
rounded_values : ht.DNDarray
A tensor containing the rounded value of each element in x.
"""

return rounding.round(x, decimals, out, dtype)

def __rpow__(self, other):
Expand Down
53 changes: 26 additions & 27 deletions heat/core/rounding.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,34 +180,33 @@ def floor(x, out=None):

def modf(x, out=None):
"""
Return the fractional and integral parts of a tensor, element-wise.
The fractional and integral parts are negative if the given number is negative.
Parameters
----------
x : ht.DNDarray
Input tensor
out : tuple(ht.DNDarray, ht.DNDarray), optional
A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to.
If not provided or None, a freshly-allocated tensor is returned.
Returns
-------
tuple(ht.DNDarray: fractionalParts, ht.DNDarray: integralParts)
fractionalParts : ht.DNDdarray
Fractional part of x. This is a scalar if x is a scalar.
integralParts : ht.DNDdarray
Integral part of x. This is a scalar if x is a scalar.
Examples
--------
>>> ht.modf(ht.arange(-2.0, 2.0, 0.4))
(tensor([-2., -1., -1., -0., -0., 0., 0., 0., 1., 1.]),
tensor([ 0.0000, -0.6000, -0.2000, -0.8000, -0.4000, 0.0000, 0.4000, 0.8000, 0.2000, 0.6000]))
"""
Return the fractional and integral parts of a tensor, element-wise.
The fractional and integral parts are negative if the given number is negative.
Parameters
----------
x : ht.DNDarray
Input tensor
out : tuple(ht.DNDarray, ht.DNDarray), optional
A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to.
If not provided or None, a freshly-allocated tensor is returned.
Returns
-------
tuple(ht.DNDarray: fractionalParts, ht.DNDarray: integralParts)
fractionalParts : ht.DNDdarray
Fractional part of x. This is a scalar if x is a scalar.
integralParts : ht.DNDdarray
Integral part of x. This is a scalar if x is a scalar.
Examples
--------
>>> ht.modf(ht.arange(-2.0, 2.0, 0.4))
(tensor([-2., -1., -1., -0., -0., 0., 0., 0., 1., 1.]),
tensor([ 0.0000, -0.6000, -0.2000, -0.8000, -0.4000, 0.0000, 0.4000, 0.8000, 0.2000, 0.6000]))
"""
if not isinstance(x, dndarray.DNDarray):
raise TypeError("expected x to be a ht.DNDarray, but was {}".format(type(x)))

Expand Down

0 comments on commit cfa1f74

Please sign in to comment.