Skip to content

Commit 76847bd

Browse files
committed
support_dict_type_in_pack_sequence_as
1 parent 4737304 commit 76847bd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

python/paddle/utils/layers_utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,12 @@ def _packed_nest_with_indices(structure, flat, index):
219219
packed.append(_sequence_like(s, child))
220220
index = new_index
221221
else:
222-
packed.append(flat[index])
222+
# Paddle requires python version > 3.7, so dict is always OrderedDict
223+
packed.append(
224+
flat[index]
225+
if not isinstance(flat, dict)
226+
else list(flat.values())[index]
227+
)
223228
index += 1
224229
return index, packed
225230

0 commit comments

Comments
 (0)