Skip to content

Commit

Permalink
Fix PR minor comments
Browse files Browse the repository at this point in the history
  • Loading branch information
liord committed Dec 22, 2024
1 parent 76a4ec7 commit 11d8535
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,7 @@ def is_opset_in_model(tp_model: TargetPlatformModel, opset_name: str) -> bool:
bool: True if an OperatorsSet with the given name exists in the target platform model,
otherwise False.
"""
if tp_model.operator_set is None:
return False
else:
return opset_name in [x.name for x in tp_model.operator_set]

return tp_model.operator_set is not None and opset_name in [x.name for x in tp_model.operator_set]

def get_opset_by_name(tp_model: TargetPlatformModel, opset_name: str) -> Optional[OperatorsSetBase]:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self,
self.op_sets_to_layers = OperationsToLayers() # Init an empty OperationsToLayers
self.layer2qco, self.filterlayer2qco = {}, {} # Init empty mappings from layers/LayerFilterParams to QC options
# Track the unused opsets for warning purposes.
self.__tp_model_opsets_not_used = [s.name for s in tp_model.operator_set] if tp_model.operator_set else []
self.__tp_model_opsets_not_used = [s.name for s in tp_model.operator_set]
self.remove_fusing_names_from_not_used_list()

def get_layers_by_opset_name(self, opset_name: str) -> List[Any]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ def test_opset_not_in_tp(self):
tpc_minor_version=None,
tpc_patch_version=None,
tpc_platform_type=None,
operator_set=tuple([schema.OperatorsSet("opA")]),
add_metadata=False)
hm_pytorch = tp.TargetPlatformCapabilities(hm)
with self.assertRaises(Exception) as e:
Expand Down

0 comments on commit 11d8535

Please sign in to comment.