634c2049b8f95c45495811197346964e0826df2e,src/graph_transpiler/webdnn/backend/interface/generator.py,,generate_descriptor,#,81

Before Change


    
    generator = get_generator(backend)

    try:
        // Graph is transformed by backend-specific optimization
        graph = copy.deepcopy(graph)
    except RecursionError:
        // Occurs when the graph has many nodes (e.g. ResNet)
        raise RecursionError("Recursion error occurred when copying graph." +
                             " sys.setrecursionlimit(10000) may help fixing it.")

    // some optimize rule work even when OPTIMIZE=0
    graph, _ = GeneralOptimizeRule().optimize(graph)

    return generator(graph, **kwargs)

After Change


    

    result = []
    error = []

    // run on thread which have large stack
    def worker():
        try:
            generator = get_generator(backend)

            // Graph is transformed by backend-specific optimization
            c_graph = copy.deepcopy(graph)

            // some optimize rule work even when OPTIMIZE=0
            opt_graph, _ = GeneralOptimizeRule().optimize(c_graph)

            result.append(generator(opt_graph, **kwargs))
        except Exception as ex:
            error.append(ex)

    if flags.NO_WORKER_THREAD:
        worker()
    else:
        import threading
        sys.setrecursionlimit(16384)
        threading.stack_size(64 * 1024 * 1024)
        t = threading.Thread(target=worker)
        t.start()
        t.join()
    if len(error) > 0:
        raise error[0]
    return result[0]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: mil-tokyo/webdnn
Commit Name: 634c2049b8f95c45495811197346964e0826df2e
Time: 2018-11-18
Author: hidaka@mi.t.u-tokyo.ac.jp
File Name: src/graph_transpiler/webdnn/backend/interface/generator.py
Class Name:
Method Name: generate_descriptor


Project Name: ikostrikov/pytorch-a2c-ppo-acktr
Commit Name: 4586366c1018257dd448d62f1fc7534e3f5a4338
Time: 2017-11-23
Author: ikostrikov@gmail.com
File Name: enjoy.py
Class Name:
Method Name:


Project Name: hachmannlab/chemml
Commit Name: 80d32c6793323bb1a1c0bb55faef8f9b5d30f62a
Time: 2018-10-02
Author: mojtabah@buffalo.edu
File Name: chemml/chem/magpie_python/vassal/geometry/Line.py
Class Name: Line
Method Name: distance