Skip to content

Commit

Permalink
metatypes_to_ignore quantization propagation solver test
Browse files Browse the repository at this point in the history
  • Loading branch information
daniil-lyakhov committed Oct 9, 2023
1 parent c6dcc08 commit 48da94e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/common/quantization/test_quantizer_propagation_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1839,3 +1839,28 @@ def test_quantizers_are_not_set_up_for_integer_inputs(self, ip_graph_with_int_ed
assert double_input_pq.current_location_node_key == InsertionPointGraph.get_pre_hook_node_key(
"5 /E_0", input_port_id=1
)


def test_metatypes_to_ignore(mocker):
# pylint: disable=protected-access
NOT_IGNORED_METATYHPE = "not_ignored_metatype"
IGNORED_METATYPE = "target_metatype"

nncf_graph = NNCFGraph()
nodes = []
for node_name, node_metatype in zip("ABC", [NOT_IGNORED_METATYHPE, IGNORED_METATYPE, NOT_IGNORED_METATYHPE]):
nodes.append(nncf_graph.add_nncf_node(node_name, node_name, node_metatype=node_metatype))
for idx in range(1, len(nodes)):
nncf_graph.add_edge_between_nncf_nodes(
nodes[idx - 1].node_id, nodes[idx].node_id, [1, 1, 1, 1], 0, 0, Dtype.FLOAT
)
ip_graph = InsertionPointGraph(nncf_graph=nncf_graph, weight_modifiable_node_names=["A", "B", "C"])

solver = QuantizerPropagationSolver(
metatypes_to_ignore=[IGNORED_METATYPE],
)
solver._add_node_to_ignored = mocker.MagicMock()
solver.run_on_ip_graph(ip_graph)

solver._add_node_to_ignored.assert_called_once()
assert "1 B" in solver._add_node_to_ignored.call_args[0]

0 comments on commit 48da94e

Please sign in to comment.