def annotate_unary_shared_observer_ops(
    model: _torch.fx.GraphModule,
    ops: _List[_Callable],
    quantization_config: _Optional[_AnnotationConfig],
    filter_fn: _Optional[_Callable[[_Node], bool]] = None,
) -> _Optional[_List[_List[_Node]]]:
    """
    Annotates all nodes in ``model``, which correspond to unary ops specified in ``ops``.

    input --> op --> output

    input and output nodes share the same quantization parameters.
    """
    partitions = _get_source_partitions(model.graph, ops, filter_fn)
    annotated_partitions = []
    for _, op_partitions in partitions.items():
        for partition in op_partitions:
            output_node = partition.output_nodes[0]
            op_node = partition.nodes[0]
            if _is_annotated([output_node, op_node]):
                continue

            input_node = op_node.args[0]

            input_act_qspec = (
                quantization_config.input_activation if quantization_config else None
            )
            output_act_qspec = (
                quantization_config.output_activation if quantization_config else None
            )

            if (
                "quantization_annotation" not in input_node.meta
                or not input_node.meta["quantization_annotation"]._annotated
                or input_node.meta["quantization_annotation"].output_qspec is None
                or input_act_qspec is None
                or output_act_qspec is None
            ):
                continue

            # input and output of op will share quantization parameter with input of op
            act_qspec = _SharedQuantizationSpec(input_node)
            op_node.meta["quantization_annotation"] = _QuantizationAnnotation(
                input_qspec_map={
                    input_node: act_qspec,
                },
                _annotated=True,
            )
            output_node.meta["quantization_annotation"] = _QuantizationAnnotation(
                output_qspec=act_qspec,
                _annotated=True,
            )
            annotated_partitions.append(partition.nodes)
    return annotated_partitions

    Annotates all nodes in ``model``, which correspond to unary ops specified in ``ops``.

    input --> op --> output

    input and output nodes share the same quantization parameters.
    
coremltools/optimize/torch/quantization/_coreml_quantizer_utils.py