Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Target Platform Capabilities - Phase 3 #1297

Merged
merged 7 commits into from
Dec 22, 2024

Conversation

lior-dikstein
Copy link
Collaborator

@lior-dikstein lior-dikstein commented Dec 18, 2024

Remove context manager functionality from Target Platform Model. Fix all tests and tp models.
Make all schema classes fully immutable (no more lists).

Pull Request Description:

Checklist before requesting a review:

  • I set the appropriate labels on the pull request.
  • I have added/updated the release note draft (if necessary).
  • I have updated the documentation to reflect my changes (if necessary).
  • All function and files are well documented.
  • All function and classes have type hints.
  • There is a licenses in all file.
  • The function and variable names are informative.
  • I have checked for code duplications.
  • I have added new unittest (if necessary).

Remove context manager functionality from Target Platform Model.
Fix all tests and tp models.
@@ -82,7 +82,10 @@ 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.
"""
return opset_name in [x.name for x in tp_model.operator_set]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@@ -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]
self.__tp_model_opsets_not_used = [s.name for s in tp_model.operator_set] if tp_model.operator_set else []
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can tp_model.operator_set be None? isn't it something that we want to raise exception on or is it a common case that we can handle?
anyway, I don;t like the empty list initialization here, if a None tp_model.operator_set might raise issues going forward than we should address it and not hide it with an empty list

@lior-dikstein lior-dikstein merged commit b125f96 into main Dec 22, 2024
42 checks passed
@lior-dikstein lior-dikstein deleted the tpc_refactor_phase3 branch December 22, 2024 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants