Skip to content

Commit

Permalink
Fix random.sample for python312 (#2914)
Browse files Browse the repository at this point in the history
### Reason for changes

```
        if not isinstance(population, _Sequence):
>           raise TypeError("Population must be a sequence.  "
                            "For dicts or sets, use sorted(d).")
E           TypeError: Population must be a sequence.  For dicts or sets, use sorted(d).
```
  • Loading branch information
AlexanderDokuchaev authored Aug 29, 2024
1 parent 6be2fd5 commit 2a52f86
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/common/quantization/mock_graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def get_randomly_connected_model_graph(op_name_keys: Set[str]) -> nx.DiGraph:
graph_len = len(op_name_keys)
mock_graph = nx.generators.gnc_graph(graph_len, None, 0)

shuffled_op_names = random.sample(op_name_keys, len(op_name_keys))
shuffled_op_names = random.sample(sorted(op_name_keys), len(op_name_keys))
for idx, (_, node) in enumerate(mock_graph.nodes.items()):
op_name = shuffled_op_names[idx]
node[NNCFNode.NODE_NAME_ATTR] = get_node_name(shuffled_op_names[idx])
Expand Down

0 comments on commit 2a52f86

Please sign in to comment.