PyTorch Error: `lengths` Array Must Be Sorted in Decreasing Order for `pack_padded_sequence` and `pack_sequence`
This message indicates that when using the pack_padded_sequence or pack_sequence functions in PyTorch, the lengths array must be sorted in decreasing order if the enforce_sorted parameter is set to True. This requirement ensures compatibility with ONNX, a standard for exchanging machine learning models. However, if ONNX exportability isn't a concern, you can set enforce_sorted to False to avoid sorting the lengths array. This can simplify your code and potentially improve performance if sorting is not essential.
原文地址: https://www.cveoy.top/t/topic/kgpo 著作权归作者所有。请勿转载和采集!