Skip to content

Commit ca8e025

Browse files
stas00facebook-github-bot
authored andcommitted
improve the doc of enforce_sorted in pack_padded_sequence (pytorch#33617)
Summary: this is a follow up PR to pytorch#33602: torch/nn/utils/rnn.html: `pack_padded_sequence` has a confusing and incomplete description of the `enforce_sorted` param. Currently it goes: ``` enforce_sorted (bool, optional): if ``True``, the input is expected to contain sequences sorted by length in a decreasing order. If ``False``, this condition is not checked. Default: ``True``. ``` The second part "this condition is not checked" (1) makes no sense since the alluded to condition is not described and (2) it's incomplete as it doesn't reflect the important part, that it actually does the sorting. I think it should say something like: ``` enforce_sorted (bool, optional): if ``True``, the input is expected to contain sequences sorted by length in a decreasing order. If ``False``, the input will get sorted unconditionally. Default: ``True``. ``` Pull Request resolved: pytorch#33617 Differential Revision: D20035131 Pulled By: albanD fbshipit-source-id: 654382eb0cb62b5abc78497faa5b4bca42db5fda
1 parent 293fa5f commit ca8e025

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torch/nn/utils/rnn.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def pack_padded_sequence(input, lengths, batch_first=False, enforce_sorted=True)
209209
format.
210210
enforce_sorted (bool, optional): if ``True``, the input is expected to
211211
contain sequences sorted by length in a decreasing order. If
212-
``False``, this condition is not checked. Default: ``True``.
212+
``False``, the input will get sorted unconditionally. Default: ``True``.
213213
214214
Returns:
215215
a :class:`PackedSequence` object

0 commit comments

Comments
 (0)