android_test.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:MachineLearningTutorial 作者: SpikeKing 项目源码 文件源码
def gnr_optimize_graph(graph_path, optimized_graph_path):
    """
    ???
    :param graph_path: ???
    :param optimized_graph_path: ????
    :return: NULL
    """
    input_graph_def = tf.GraphDef()  # ?????
    with tf.gfile.Open(graph_path, "r") as f:
        data = f.read()
        input_graph_def.ParseFromString(data)

    # ??????????????????1/4
    output_graph_def = optimize_for_inference_lib.optimize_for_inference(
        input_graph_def,
        ["I"],  # an array of the input node(s)
        ["O"],  # an array of output nodes
        tf.float32.as_datatype_enum)

    # ??????
    f = tf.gfile.FastGFile(optimized_graph_path, "w")
    f.write(output_graph_def.SerializeToString())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号