PyTorch Error: 'lengths' Array Must Be Sorted in Decreasing Order with `enforce_sorted=True`
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 is necessary for ONNX export compatibility. However, if ONNX export is not needed, setting 'enforce_sorted' to 'False' allows you to bypass this sorting requirement.
原文地址: https://www.cveoy.top/t/topic/kgpj 著作权归作者所有。请勿转载和采集!