Skip to content

Commit a99ec3a

Browse files
ratgrtensorflower-gardener
authored andcommitted
The change ensures that the elements are packed back into the original structure in the correct order by using keys derived from the structure's flattened paths.
PiperOrigin-RevId: 915766611
1 parent 73055fc commit a99ec3a

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • tensorflow_model_optimization/python/core/internal/tensor_encoding/core

tensorflow_model_optimization/python/core/internal/tensor_encoding/core/simple_encoder.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,12 @@ def decode_fn(encoded_structure):
134134
encoded_structure = py_utils.merge_dicts(encoded_structure,
135135
encoded_py_structure['flat_py'])
136136
encoded_structure = tf.nest.pack_sequence_as(
137-
encoded_py_structure['full'], tf.nest.flatten(encoded_structure))
137+
encoded_py_structure['full'],
138+
[
139+
encoded_structure[k] for k, _ in
140+
py_utils.flatten_with_joined_string_paths(
141+
encoded_py_structure['full'])
142+
])
138143
return encoder.decode(encoded_structure[_TENSORS],
139144
encoded_structure[_PARAMS],
140145
encoded_structure[_SHAPES])

0 commit comments

Comments
 (0)