def set_node_output_quantized(nodes):
    r"""
    # For interation, EmbeddingBag, MergedEmbWithCat, pooling and elt_wise,
    # we only support INT8->INT*, if those ops have quantized their inputs,
    # we need make sure their output also have falk quant to make them call in INT8 kernel.
    # this function will check whether the output inf dtype is int8 dtype if its' input is set to quantized, if the
    # output's infe dtype is not int8, set it and also set insert_fake_quant_after_output to True.
    """

    def _reset_post_node_input_infos(node):
        # make sure the post node will insert fake quant if we add fake quant by cur node' output
        if len(node.post_nodes) > 0:
            for post_node in node.post_nodes:
                if post_node.qconfig is not None:
                    for idx, tensor_info in enumerate(post_node.input_tensor_infos):
                        if tensor_info in node.output_tensor_infos:
                            post_node.input_tensor_force_inf_dtype[idx] = (
                                tensor_info.orig_dtype
                            )
                elif post_node.type == str(nn.Identity):
                    _reset_post_node_input_infos(post_node)

    for node in nodes:
        if isinstance(node, ParentNode):
            continue
        if node.qconfig is not None and node.type in int8_int8_ops:
            post_node_are_quantized = _check_after_nodes_all_quantized_give_node(node)
            if node.type in (
                str(torch.nn.EmbeddingBag),
                str(MergedEmbeddingBagWithCat),
            ):
                if (
                    node.weight_tensor_infos[0].inf_dtype == torch.qint8
                    and not post_node_are_quantized
                ):
                    node.output_tensor_infos[0].inf_dtype = torch.qint8
                    node.insert_fake_quant_after_outputs[0] = True
                    _reset_post_node_input_infos(node)
            elif node.type == str(F.embedding_bag):
                if (
                    node.input_tensor_force_inf_dtype[1] == torch.qint8
                    and not post_node_are_quantized
                ):
                    node.output_tensor_infos[0].inf_dtype = torch.qint8
                    node.insert_fake_quant_after_outputs[0] = True
                    _reset_post_node_input_infos(node)
            elif node.type in [
                str(interaction),
                str(torch.ops.torch_ipex.interaction_forward),
                str(torch.ops.torch_ipex.merged_embeddingbag_cat_forward),
            ]:
                if (
                    node.input_tensor_force_inf_dtype[0] == torch.qint8
                    and not post_node_are_quantized
                ):
                    node.output_tensor_infos[0].inf_dtype = torch.qint8
                    node.insert_fake_quant_after_outputs[0] = True
                    _reset_post_node_input_infos(node)
            else:
                # TODO: enable PackedSequence input for LSTM.
                if not (
                    node.type in [nn.LSTM]
                    and len(node.input_tensor_infos) > 2
                    and node.input_tensor_infos[1].orig_dtype == torch.int64
                ):
                    if (
                        node.input_tensor_force_inf_dtype[0]
                        in [torch.qint8, torch.quint8]
                        and not post_node_are_quantized
                    ):
                        node.output_tensor_infos[0].inf_dtype = (
                            node.input_tensor_force_inf_dtype[0]
                        )
                        node.insert_fake_quant_after_outputs[0] = True
                        _reset_post_node_input_infos(node)

    # For interation, EmbeddingBag, MergedEmbWithCat, pooling and elt_wise,
    # we only support INT8->INT*, if those ops have quantized their inputs,
    # we need make sure their output also have falk quant to make them call in INT8 kernel.
    # this function will check whether the output inf dtype is int8 dtype if its' input is set to quantized, if the
    # output's infe dtype is not int8, set it and also set insert_fake_quant_after_output to True.
    
intel_extension_for_pytorch/quantization/_utils.py