Skip to content

Commit

Permalink
Fix torch.bucketize docs for "right"
Browse files Browse the repository at this point in the history
The docs correctly (i.e matching actual op behavior) state that

`right = False` means `boundaries[i-1] < input[m][n]...[l][x] <= boundaries[i]`.

However they previously stated that
`If 'right' is False (default), then the left boundary is closed.`

which contradicts the `boundaries[i-1] < input[m][n]...[l][x] <= boundaries[i]` statement.

This modifies the docs to say `... then the left boundary is OPEN.` and also clarifies that this is the opposite behavior of numpy.digitize.

ghstack-source-id: 641dc9124bc6075dfe15faaf70ff29a5e843e612
Pull Request resolved: #104474
  • Loading branch information
davidberard98 committed Aug 16, 2023
1 parent f76250f commit f1da2eb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions torch/_torch_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13787,8 +13787,10 @@ def merge_dicts(*dicts):
Returns the indices of the buckets to which each value in the :attr:`input` belongs, where the
boundaries of the buckets are set by :attr:`boundaries`. Return a new tensor with the same size
as :attr:`input`. If :attr:`right` is False (default), then the left boundary is closed. More
formally, the returned index satisfies the following rules:
as :attr:`input`. If :attr:`right` is False (default), then the left boundary is open. Note that
this behavior is opposite the behavior of
`numpy.digitize <https://docs.scipy.org/doc/numpy/reference/generated/numpy.digitize.html>`_
More formally, the returned index satisfies the following rules:
.. list-table::
:widths: 15 85
Expand Down

0 comments on commit f1da2eb

Please sign in to comment.