[torch.arange] Small epsilon should be subtracted from end
, not added to end
#99853
Labels
actionable
module: docs
Related to our documentation, both in docs/ and docblocks
triaged
This issue has been looked at a team member, and triaged and prioritized into an appropriate module
馃摎 The doc issue
In https://pytorch.org/docs/stable/generated/torch.arange.html,
"""
Note that non-integer step is subject to floating point rounding errors when comparing against end; to avoid inconsistency, we advise adding a small epsilon to end in such cases.
"""
However, this is inconsistent with the exclusion behavior of
end
. Now the originally intendedend
may be always included. To exclude the originalend
, the newend
must be slightly smaller than that.Example script (could be environment dependent)
gives
Suggest a potential alternative/fix
"""
Note that non-integer step is subject to floating point rounding errors when comparing against end; to avoid inconsistency, we advise subtracting a small epsilon from end in such cases.
"""
cc @svekars @carljparker
The text was updated successfully, but these errors were encountered: