Esempio n. 1
0
def prepare_ir(argv: argparse.Namespace):
    argv = arguments_post_parsing(argv)
    t = tm.Telemetry()
    graph = None
    ngraph_function = None
    moc_front_end, available_moc_front_ends = get_moc_frontends(argv)
    if moc_front_end:
        fallback_reasons = check_fallback(argv)
        if len(fallback_reasons) == 0:
            t.send_event("mo", "conversion_method",
                         moc_front_end.get_name() + "_frontend")
            moc_front_end.add_extension(
                TelemetryExtension("mo", t.send_event, t.send_error,
                                   t.send_stack_trace))
            moc_front_end.add_extension(
                ProgressReporterExtension(progress_printer(argv)))
            ngraph_function = moc_pipeline(argv, moc_front_end)
            return graph, ngraph_function
        else:  # apply fallback
            reasons_message = ", ".join(fallback_reasons)
            load_extensions(argv, *list(deduce_framework_by_namespace(argv)))
            t.send_event("mo", "fallback_reason", reasons_message)
            log.warning(
                "The IR preparation was executed by the legacy MO path. "
                "This is a fallback scenario applicable only for some specific cases. "
                f"The detailed reason why fallback was executed: not supported {reasons_message} were used. "
                "You can specify --use_new_frontend flag to force using the Frontend MO path to avoid additional checks. "
                + refer_to_faq_msg(105))

    t.send_event("mo", "conversion_method", "mo_legacy")
    graph = unified_pipeline(argv)

    return graph, ngraph_function
Esempio n. 2
0
def prepare_ir(argv):
    argv = arguments_post_parsing(argv)

    t = tm.Telemetry()
    graph = None
    ngraph_function = None
    moc_front_end, available_moc_front_ends = get_moc_frontends(argv)

    if moc_front_end:
        t.send_event("mo", "conversion_method",
                     moc_front_end.get_name() + "_frontend")
        moc_front_end.add_extension(
            TelemetryExtension("mo", t.send_event, t.send_error,
                               t.send_stack_trace))
        moc_front_end.add_extension(
            ProgressReporterExtension(progress_printer(argv)))
        ngraph_function = moc_pipeline(argv, moc_front_end)
    else:
        t.send_event("mo", "conversion_method", "mo_legacy")
        graph = unified_pipeline(argv)

    return graph, ngraph_function