-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TorchFX] Graph/metatypes tests implementation (#2796)
### Changes 1. Added pytest to check if all the ops in the generated graph for resnet18, mobilenet_v3_small, vit_b_16, swin_v2_s and yolov8n models have valid metatypes in NNCF 2. Added pytest to check if the generated NNCF graph for resnet18, mobilenet_v3_small, vit_b_16, swin_v2_s and yolov8n match with reference graphs. (tests/torch/fx/test_models.py) 3. Add metatype mapping for the following: - linalg_vector_norm - clamp - clamp_min - hardswish_ - dropout_ ### Reason for changes Check if all model ops are supported by NNCF metatypes ### Related tickets #2778 ### Tests New test file test_models.py added in tests/torch/fx/test_models.py --------- Co-authored-by: dlyakhov <[email protected]>
- Loading branch information
1 parent
d1e4ec5
commit 25eff06
Showing
17 changed files
with
11,958 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
992 changes: 992 additions & 0 deletions
992
tests/torch/data/reference_graphs/fx/mobilenet_v3_small.dot
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
tests/torch/data/reference_graphs/fx/reference_metatypes/mobilenet_v3_small.json
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
tests/torch/data/reference_graphs/fx/reference_metatypes/resnet18.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"arg0_1": "input_noop", "_param_constant0": "const_noop", "conv2d": "Conv2DOp", "empty": "unknown", "_param_constant1": "const_noop", "_param_constant2": "const_noop", "_tensor_constant0": "const_noop", "_tensor_constant1": "const_noop", "_native_batch_norm_legit_no_training": "BatchNormOp", "getitem": "GatherOp", "getitem_1": "GatherOp", "getitem_2": "GatherOp", "relu_": "ReluOp", "max_pool2d": "MaxPool2DOp", "_param_constant3": "const_noop", "conv2d_1": "Conv2DOp", "empty_1": "unknown", "_param_constant4": "const_noop", "_param_constant5": "const_noop", "_tensor_constant2": "const_noop", "_tensor_constant3": "const_noop", "_native_batch_norm_legit_no_training_1": "BatchNormOp", "getitem_3": "GatherOp", "getitem_4": "GatherOp", "getitem_5": "GatherOp", "relu__1": "ReluOp", "_param_constant6": "const_noop", "conv2d_2": "Conv2DOp", "empty_2": "unknown", "_param_constant7": "const_noop", "_param_constant8": "const_noop", "_tensor_constant4": "const_noop", "_tensor_constant5": "const_noop", "_native_batch_norm_legit_no_training_2": "BatchNormOp", "getitem_6": "GatherOp", "getitem_7": "GatherOp", "getitem_8": "GatherOp", "add_": "AddOp", "relu__2": "ReluOp", "_param_constant9": "const_noop", "conv2d_3": "Conv2DOp", "empty_3": "unknown", "_param_constant10": "const_noop", "_param_constant11": "const_noop", "_tensor_constant6": "const_noop", "_tensor_constant7": "const_noop", "_native_batch_norm_legit_no_training_3": "BatchNormOp", "getitem_9": "GatherOp", "getitem_10": "GatherOp", "getitem_11": "GatherOp", "relu__3": "ReluOp", "_param_constant12": "const_noop", "conv2d_4": "Conv2DOp", "empty_4": "unknown", "_param_constant13": "const_noop", "_param_constant14": "const_noop", "_tensor_constant8": "const_noop", "_tensor_constant9": "const_noop", "_native_batch_norm_legit_no_training_4": "BatchNormOp", "getitem_12": "GatherOp", "getitem_13": "GatherOp", "getitem_14": "GatherOp", "add__1": "AddOp", "relu__4": "ReluOp", "_param_constant15": "const_noop", "conv2d_5": "Conv2DOp", "empty_5": "unknown", "_param_constant16": "const_noop", "_param_constant17": "const_noop", "_tensor_constant10": "const_noop", "_tensor_constant11": "const_noop", "_native_batch_norm_legit_no_training_5": "BatchNormOp", "getitem_15": "GatherOp", "getitem_16": "GatherOp", "getitem_17": "GatherOp", "relu__5": "ReluOp", "_param_constant18": "const_noop", "conv2d_6": "Conv2DOp", "empty_6": "unknown", "_param_constant19": "const_noop", "_param_constant20": "const_noop", "_tensor_constant12": "const_noop", "_tensor_constant13": "const_noop", "_native_batch_norm_legit_no_training_6": "BatchNormOp", "getitem_18": "GatherOp", "getitem_19": "GatherOp", "getitem_20": "GatherOp", "_param_constant21": "const_noop", "conv2d_7": "Conv2DOp", "empty_7": "unknown", "_param_constant22": "const_noop", "_param_constant23": "const_noop", "_tensor_constant14": "const_noop", "_tensor_constant15": "const_noop", "_native_batch_norm_legit_no_training_7": "BatchNormOp", "getitem_21": "GatherOp", "getitem_22": "GatherOp", "getitem_23": "GatherOp", "add__2": "AddOp", "relu__6": "ReluOp", "_param_constant24": "const_noop", "conv2d_8": "Conv2DOp", "empty_8": "unknown", "_param_constant25": "const_noop", "_param_constant26": "const_noop", "_tensor_constant16": "const_noop", "_tensor_constant17": "const_noop", "_native_batch_norm_legit_no_training_8": "BatchNormOp", "getitem_24": "GatherOp", "getitem_25": "GatherOp", "getitem_26": "GatherOp", "relu__7": "ReluOp", "_param_constant27": "const_noop", "conv2d_9": "Conv2DOp", "empty_9": "unknown", "_param_constant28": "const_noop", "_param_constant29": "const_noop", "_tensor_constant18": "const_noop", "_tensor_constant19": "const_noop", "_native_batch_norm_legit_no_training_9": "BatchNormOp", "getitem_27": "GatherOp", "getitem_28": "GatherOp", "getitem_29": "GatherOp", "add__3": "AddOp", "relu__8": "ReluOp", "_param_constant30": "const_noop", "conv2d_10": "Conv2DOp", "empty_10": "unknown", "_param_constant31": "const_noop", "_param_constant32": "const_noop", "_tensor_constant20": "const_noop", "_tensor_constant21": "const_noop", "_native_batch_norm_legit_no_training_10": "BatchNormOp", "getitem_30": "GatherOp", "getitem_31": "GatherOp", "getitem_32": "GatherOp", "relu__9": "ReluOp", "_param_constant33": "const_noop", "conv2d_11": "Conv2DOp", "empty_11": "unknown", "_param_constant34": "const_noop", "_param_constant35": "const_noop", "_tensor_constant22": "const_noop", "_tensor_constant23": "const_noop", "_native_batch_norm_legit_no_training_11": "BatchNormOp", "getitem_33": "GatherOp", "getitem_34": "GatherOp", "getitem_35": "GatherOp", "_param_constant36": "const_noop", "conv2d_12": "Conv2DOp", "empty_12": "unknown", "_param_constant37": "const_noop", "_param_constant38": "const_noop", "_tensor_constant24": "const_noop", "_tensor_constant25": "const_noop", "_native_batch_norm_legit_no_training_12": "BatchNormOp", "getitem_36": "GatherOp", "getitem_37": "GatherOp", "getitem_38": "GatherOp", "add__4": "AddOp", "relu__10": "ReluOp", "_param_constant39": "const_noop", "conv2d_13": "Conv2DOp", "empty_13": "unknown", "_param_constant40": "const_noop", "_param_constant41": "const_noop", "_tensor_constant26": "const_noop", "_tensor_constant27": "const_noop", "_native_batch_norm_legit_no_training_13": "BatchNormOp", "getitem_39": "GatherOp", "getitem_40": "GatherOp", "getitem_41": "GatherOp", "relu__11": "ReluOp", "_param_constant42": "const_noop", "conv2d_14": "Conv2DOp", "empty_14": "unknown", "_param_constant43": "const_noop", "_param_constant44": "const_noop", "_tensor_constant28": "const_noop", "_tensor_constant29": "const_noop", "_native_batch_norm_legit_no_training_14": "BatchNormOp", "getitem_42": "GatherOp", "getitem_43": "GatherOp", "getitem_44": "GatherOp", "add__5": "AddOp", "relu__12": "ReluOp", "_param_constant45": "const_noop", "conv2d_15": "Conv2DOp", "empty_15": "unknown", "_param_constant46": "const_noop", "_param_constant47": "const_noop", "_tensor_constant30": "const_noop", "_tensor_constant31": "const_noop", "_native_batch_norm_legit_no_training_15": "BatchNormOp", "getitem_45": "GatherOp", "getitem_46": "GatherOp", "getitem_47": "GatherOp", "relu__13": "ReluOp", "_param_constant48": "const_noop", "conv2d_16": "Conv2DOp", "empty_16": "unknown", "_param_constant49": "const_noop", "_param_constant50": "const_noop", "_tensor_constant32": "const_noop", "_tensor_constant33": "const_noop", "_native_batch_norm_legit_no_training_16": "BatchNormOp", "getitem_48": "GatherOp", "getitem_49": "GatherOp", "getitem_50": "GatherOp", "_param_constant51": "const_noop", "conv2d_17": "Conv2DOp", "empty_17": "unknown", "_param_constant52": "const_noop", "_param_constant53": "const_noop", "_tensor_constant34": "const_noop", "_tensor_constant35": "const_noop", "_native_batch_norm_legit_no_training_17": "BatchNormOp", "getitem_51": "GatherOp", "getitem_52": "GatherOp", "getitem_53": "GatherOp", "add__6": "AddOp", "relu__14": "ReluOp", "_param_constant54": "const_noop", "conv2d_18": "Conv2DOp", "empty_18": "unknown", "_param_constant55": "const_noop", "_param_constant56": "const_noop", "_tensor_constant36": "const_noop", "_tensor_constant37": "const_noop", "_native_batch_norm_legit_no_training_18": "BatchNormOp", "getitem_54": "GatherOp", "getitem_55": "GatherOp", "getitem_56": "GatherOp", "relu__15": "ReluOp", "_param_constant57": "const_noop", "conv2d_19": "Conv2DOp", "empty_19": "unknown", "_param_constant58": "const_noop", "_param_constant59": "const_noop", "_tensor_constant38": "const_noop", "_tensor_constant39": "const_noop", "_native_batch_norm_legit_no_training_19": "BatchNormOp", "getitem_57": "GatherOp", "getitem_58": "GatherOp", "getitem_59": "GatherOp", "add__7": "AddOp", "relu__16": "ReluOp", "adaptive_avg_pool2d": "AvgPool2DOp", "flatten": "ReshapeOp", "_param_constant60": "const_noop", "_param_constant61": "const_noop", "linear": "LinearOp", "output": "output_noop"} |
1 change: 1 addition & 0 deletions
1
tests/torch/data/reference_graphs/fx/reference_metatypes/swin_v2_s.json
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
tests/torch/data/reference_graphs/fx/reference_metatypes/vit_b_16.json
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
tests/torch/data/reference_graphs/fx/reference_metatypes/yolov8n.json
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.