def convert_ops(const_context, builder, ops, outputs):
    """
    const_context: list[set of str]: const name for v1 & v2 (the same)
    builder: neural_network.NeuralNetworkBuilder
    ops: list[Operation], usually from Block.operations.
    outputs: list[Var]. block outputs
    """

    const_context.append(set())
    custom_ops = SSAOpRegistry.custom_ops
    for op in _tqdm(ops, desc="Translating MIL ==> NeuralNetwork Ops", unit=" ops"):
        if op.op_type in custom_ops:
            mapper = MIL_TO_NN_MAPPING_REGISTRY["custom_op"]
        elif op.op_type in MIL_TO_NN_MAPPING_REGISTRY:
            mapper = MIL_TO_NN_MAPPING_REGISTRY[op.op_type]
        else:
            msg = ("Op {} is used in the source model. This op is not supported "
                   "by the NeuralNetwork (compatibility with MacOS < 12, iOS < 15) model "
                   "type. To successfully convert this model, convert to the ML Program "
                   "model type (minimum target MacOS 12, iOS 15 and later).\n"
                   "Use coremltools.convert(..., convert_to=\"mlprogram\") to convert to ML Program.\n"
                   "block: {}")
            raise NotImplementedError(msg.format(op.op_type, op.enclosing_block))
        # const is globally shared in nn.
        mapper(const_context, builder, op)

    for ov in outputs:
        # If block return value is a const, we need to add it.
        if ov.op is None:
            continue  # placeholder
        if ov.op.op_type == "const":
            add_const(const_context, builder, ov.name, ov.val)
    const_context.pop()

    const_context: list[set of str]: const name for v1 & v2 (the same)
    builder: neural_network.NeuralNetworkBuilder
    ops: list[Operation], usually from Block.operations.
    outputs: list[Var]. block outputs
    
coremltools/converters/mil/backend/nn/op_mapping.py