def align_pool(self):
        """Align max/avg pooling input and output pos."""
        for i, node in enumerate(self.model.model.graph.node):
            if (
                node.op_type not in ["MaxPool"]
                or node.op_type not in ["AveragePool"]
                or node.op_type not in ["GlobalAveragePool"]
            ):
                continue
            ipos_name = self.get_ipos_name(node)
            ipos, ipos_layer = self.get_pos_by_name(ipos_name)

            opos_name = self.get_opos_name(node)
            opos, opos_layer = self.get_pos_by_name(opos_name)
            if ipos is not None and opos is not None and opos > ipos:
                self.set_pos(opos_layer, ipos)
                logger.info(
                    "Input pos of pooling layer {} is {}. Output pos of pooling layer {} is {}."
                    "Modify opos from {} to {}.".format(
                        node.name, int(ipos), node.name, int(opos), int(opos), int(ipos)
                    )
                )
            elif ipos is not None and opos is not None and opos < ipos:
                self.set_pos(ipos_layer, opos)
                logger.info(
                    "Input pos of pooling layer {} is {}. Output pos of pooling layer {} is {}."
                    "Modify ipos from {} to {}.".format(
                        node.name, int(ipos), node.name, int(opos), int(ipos), int(opos)
                    )
                )
Align max/avg pooling input and output pos.
olive/passes/onnx/vitis_ai/refine.py