From f274cf5bafea55b6ffedea1e10aeca095dbce618 Mon Sep 17 00:00:00 2001 From: Aleksei Kashapov Date: Wed, 25 Sep 2024 22:08:26 +0200 Subject: [PATCH] [OV] Add adaptive poolings metatypes (#2988) ### Changes Add https://docs.openvino.ai/2024/documentation/openvino-ir-format/operation-sets/operation-specs/pooling/adaptive-max-pool-8.html and https://docs.openvino.ai/2024/documentation/openvino-ir-format/operation-sets/operation-specs/pooling/adaptive-avg-pool-8.html Based on the description of the operations I make their treatments for quantization the same as for AvgPool and MaxPool. I checked the correct quantization scheme with this PR for litehernet from ticket 150502 --- nncf/openvino/graph/metatypes/groups.py | 2 ++ .../openvino/graph/metatypes/openvino_metatypes.py | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/nncf/openvino/graph/metatypes/groups.py b/nncf/openvino/graph/metatypes/groups.py index 799b6ce92bd..0b94812ab68 100644 --- a/nncf/openvino/graph/metatypes/groups.py +++ b/nncf/openvino/graph/metatypes/groups.py @@ -13,6 +13,7 @@ QUANTIZE_AGNOSTIC_OPERATIONS = [ ov_metatypes.OVMaxPoolMetatype, + ov_metatypes.OVAdaptiveMaxPoolMetatype, ov_metatypes.OVReduceMaxMetatype, ov_metatypes.OVReshapeMetatype, ov_metatypes.OVSqueezeMetatype, @@ -62,6 +63,7 @@ ov_metatypes.OVMaximumMetatype, ov_metatypes.OVMinimumMetatype, ov_metatypes.OVAvgPoolMetatype, + ov_metatypes.OVAdaptiveAvgPoolMetatype, ov_metatypes.OVReduceMeanMetatype, ov_metatypes.OVMVNMetatype, ov_metatypes.OVNormalizeL2Metatype, diff --git a/nncf/openvino/graph/metatypes/openvino_metatypes.py b/nncf/openvino/graph/metatypes/openvino_metatypes.py index 87a2677c0d7..0c7c43f3fac 100644 --- a/nncf/openvino/graph/metatypes/openvino_metatypes.py +++ b/nncf/openvino/graph/metatypes/openvino_metatypes.py @@ -157,6 +157,13 @@ class OVAvgPoolMetatype(OVOpMetatype): hw_config_names = [HWConfigOpName.AVGPOOL] +@OV_OPERATOR_METATYPES.register() +class OVAdaptiveAvgPoolMetatype(OVOpMetatype): + name = "AdaptiveAvgPoolOp" + op_names = ["AdaptiveAvgPool"] + hw_config_names = [HWConfigOpName.AVGPOOL] + + @OV_OPERATOR_METATYPES.register() class OVMaxPoolMetatype(OVOpMetatype): name = "MaxPoolOp" @@ -164,6 +171,13 @@ class OVMaxPoolMetatype(OVOpMetatype): hw_config_names = [HWConfigOpName.MAXPOOL] +@OV_OPERATOR_METATYPES.register() +class OVAdaptiveMaxPoolMetatype(OVOpMetatype): + name = "AdaptiveMaxPoolOp" + op_names = ["AdaptiveMaxPool"] + hw_config_names = [HWConfigOpName.MAXPOOL] + + @OV_OPERATOR_METATYPES.register() class OVConstantMetatype(OVOpMetatype): name = "ConstantOp"