コード例 #1
0
def estimate(args):
    """Estimate example function

    Args:
      network name (str): network name 

    Returns:
      float: estimated time in ms 
    """
    model = AnnetteGraph(
        args.network, get_database('graphs', 'annette',
                                   args.network + '.json'))

    if args.mapping != "none":
        opt = Mapping_model.from_json(
            get_database('models', 'mapping', args.mapping + '.json'))
        opt.run_optimization(model)

    # LOAD MODELS
    mod = Layer_model.from_json(
        get_database('models', 'layer', args.layer + '.json'))

    # APPLY ESTIMATION
    res = mod.estimate_model(model)
    write_result(args.network, res, args.mapping, args.layer,
                 get_database('results'))

    return res[0], res[2]
コード例 #2
0
def test_annette_to_model(network="cf_reid"):
    json_file = Path('database', 'graphs', 'annette', network + '.json')
    annette_graph = AnnetteGraph(network, json_file)

    # execute the function under test
    generator.generate_tf_model(annette_graph)
    assert True
コード例 #3
0
def test_regression_estimation():
    network_list = [
        'cf_cityscapes', 'cf_resnet50', 'cf_openpose', 'tf_mobilenetv1',
        'tf_mobilenetv2'
    ]

    json_file = Path('database', 'models', 'mapping', 'ov.json')
    ncs2_opt = Mapping_model.from_json(json_file)

    # LOAD MODELS
    ncs2_mod = {}
    json_file = Path('database', 'models', 'layer', 'ov.json')
    ncs2_mod['roofline'] = Layer_model.from_json(
        "database/models/layer/ncs2-roofline.json")
    ncs2_mod['ref_roofline'] = Layer_model.from_json(
        "database/models/layer/ncs2-ref_roofline.json")
    ncs2_mod['statistical'] = Layer_model.from_json(
        "database/models/layer/ncs2-statistical.json")
    ncs2_mod['mixed'] = Layer_model.from_json(
        "database/models/layer/ncs2-mixed.json")

    for network in network_list:
        json_file = Path('database', 'graphs', 'annette', network + '.json')
        model = AnnetteGraph(network, json_file)
        ncs2_opt.run_optimization(model)
        # APPLY ESTIMATION
        ncs2_res = {}
        ncs2_res['mixed'] = ncs2_mod['mixed'].estimate_model(model)
        ncs2_res['roofline'] = ncs2_mod['roofline'].estimate_model(model)
        ncs2_res['ref_roofline'] = ncs2_mod['ref_roofline'].estimate_model(
            model)
        ncs2_res['statistical'] = ncs2_mod['statistical'].estimate_model(model)

    assert True
コード例 #4
0
def test_estimation(network="cf_resnet50"):
    json_file = Path('database', 'graphs', 'annette', network + '.json')
    model = AnnetteGraph(network, json_file)

    json_file = Path('database', 'models', 'mapping', 'ov.json')
    ncs2_opt = Mapping_model.from_json(json_file)
    ncs2_opt.run_optimization(model)

    # LOAD MODELS
    ncs2_mod = {}
    json_file = Path('database', 'models', 'layer', 'ov.json')
    ncs2_mod['roofline'] = Layer_model.from_json(
        "database/models/layer/ncs2-roofline.json")
    ncs2_mod['ref_roofline'] = Layer_model.from_json(
        "database/models/layer/ncs2-ref_roofline.json")
    ncs2_mod['statistical'] = Layer_model.from_json(
        "database/models/layer/ncs2-statistical.json")
    ncs2_mod['mixed'] = Layer_model.from_json(
        "database/models/layer/ncs2-mixed.json")

    # APPLY ESTIMATION
    ncs2_res = {}
    ncs2_res['mixed'] = ncs2_mod['mixed'].estimate_model(model)
    ncs2_res['roofline'] = ncs2_mod['roofline'].estimate_model(model)
    ncs2_res['ref_roofline'] = ncs2_mod['ref_roofline'].estimate_model(model)
    ncs2_res['statistical'] = ncs2_mod['statistical'].estimate_model(model)

    assert True

    return model
コード例 #5
0
def test_optimization(network="cf_resnet50"):
    json_file = Path('database', 'graphs', 'annette', network + '.json')
    model = AnnetteGraph(network, json_file)

    json_file = Path('database', 'models', 'mapping', 'ov.json')
    ncs2_opt = Mapping_model.from_json(json_file)
    ncs2_opt.run_optimization(model)

    assert True

    return model
コード例 #6
0
 def __init__(self, network):
     #load graphstruct
     json_file = get_database('graphs', 'annette', network + '.json')
     self.graph = AnnetteGraph(network, json_file)
     print(self.graph)