Skip to content

Commit

Permalink
fix coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
irenaby committed Jan 26, 2025
1 parent 038e28b commit 01fcff1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -474,12 +474,12 @@ def compute_node_bops(self,
Node's BOPS count.
"""
node_mac = self.fw_impl.get_node_mac_operations(n, self.fw_info)
if node_mac == 0:
if node_mac == 0: # pragma: no cover
return node_mac

incoming_edges = self.graph.incoming_edges(n, sort_by_attr=EDGE_SINK_INDEX)
# TODO temporary adding this for const_representation test in torch which has Linear with const input
if not incoming_edges:
if not incoming_edges: # pragma: no cover
return 0
assert len(incoming_edges) == 1, \
f'Unexpected number of inputs {len(incoming_edges)} for BOPS calculation. Expected 1.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ def test_operations(self):
assert max(u) == u[0]
assert min(u) == u[2]

def test_invalid_radd(self):
with pytest.raises(ValueError, match='radd is only supported with 0'):
1 + Utilization(5, 5)


class TestComputeResurceUtilization:
""" Test compute_resource_utilization public api. """
Expand Down Expand Up @@ -438,7 +442,7 @@ def test_compute_act_tensors_utilization(self, fw_impl_mock, fw_info_mock):
def test_compute_act_tensors_utilization_errors(self, graph_mock, fw_impl_mock, fw_info_mock, bitmode):
ru_calc = ResourceUtilizationCalculator(graph_mock, fw_impl_mock, fw_info_mock)
with pytest.raises(ValueError, match=ResourceUtilizationCalculator.unexpected_qc_error):
ru_calc.compute_node_activation_tensor_utilization(build_node(), TIC.Any, bitmode, qc=build_qc())
ru_calc.compute_activation_tensors_utilization(TIC.Any, bitmode, act_qcs=Mock())


class TestActivationMaxCutUtilization:
Expand Down

0 comments on commit 01fcff1

Please sign in to comment.