-
大小: 20KB文件类型: .rar金币: 2下载: 0 次发布日期: 2021-06-15
- 语言: 其他
- 标签: tensorflow 直接量化
资源简介
tensorflow demo中以前版本支持的量化方式,在后续版本中被移除了。可用于学习如何量化,有一定价值。注意,之前该文件位于tensorflow-master/tensorflow/tools/文件夹下。
如果没有积分 可以私信我 我单独发给你

代码片段和文件信息
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License Version 2.0 (the “License“);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing software
# distributed under the License is distributed on an “AS IS“ BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
“““Converts a GraphDef file into a DOT format suitable for visualization.
This script takes a GraphDef representing a network and produces a DOT file
that can then be visualized by GraphViz tools like dot and xdot.
“““
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import re
from google.protobuf import text_format
from tensorflow.core.framework import graph_pb2
from tensorflow.python.platform import app
from tensorflow.python.platform import flags
from tensorflow.python.platform import gfile
FLAGS = flags.FLAGS
flags.DEFINE_string(“graph“ ““ “““TensorFlow ‘GraphDef‘ file to load.“““)
flags.DEFINE_bool(“input_binary“ True
“““Whether the input files are in binary format.“““)
flags.DEFINE_string(“dot_output“ ““ “““Where to write the DOT output.“““)
def main(unused_args):
if not gfile.Exists(FLAGS.graph):
print(“Input graph file ‘“ + FLAGS.graph + “‘ does not exist!“)
return -1
graph = graph_pb2.GraphDef()
with open(FLAGS.graph “r“) as f:
if FLAGS.input_binary:
graph.ParseFromString(f.read())
else:
text_format.Merge(f.read() graph)
with open(FLAGS.dot_output “wb“) as f:
print(“digraph graphname {“ file=f)
for node in graph.node:
output_name = node.name
print(“ \““ + output_name + “\“ [label=\““ + node.op + “\“];“ file=f)
for input_full_name in node.input:
parts = input_full_name.split(“:“)
input_name = re.sub(r“^\^“ ““ parts[0])
print(“ \““ + input_name + “\“ -> \““ + output_name + “\“;“ file=f)
print(“}“ file=f)
print(“Created DOT file ‘“ + FLAGS.dot_output + “‘.“)
if __name__ == “__main__“:
app.run()
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2268 2018-09-14 11:39 quantization\BUILD
文件 2418 2018-09-14 11:39 quantization\graph_to_dot.py
文件 57233 2018-09-14 11:39 quantization\quantize_graph.py
文件 42452 2018-09-14 11:39 quantization\quantize_graph_test.py
目录 0 2018-12-11 17:17 quantization
----------- --------- ---------- ----- ----
104371 5
- 上一篇:maven学习资料
- 下一篇:lcd多级菜单的实现
相关资源
- TensorFlow1.4 官方手册
- MSCNN_dehaze.rar
- 基于双向LSTM+tensorflow中文分词
- TensorFlow Machine Learning Cookbook+无码高清
- Hands-On Machine Learning with Scikit-Learn an
- TensorFlow 官方文档中文版高清无码PD
- 基于tensorflow的深度学习图像分类案例
- 基于Tensorflow多层神经网络的MNIST手写
- TensorFlow Tutorial
- TensorFlow_2.0快速应用指南英文.tar
- tensorflow图像风格迁移代码
- TensorFlow Machine Learning Cookbook
- Learning TensorFlow: A Guide to Building Deep
- tensorflow271134
- TensorFlow for Machine Intelligence 书籍源码
- 《Hands-On Machine Learning with Scikit-Learn
- Building Machine Learning Projects with Tensor
- TensorFlow Powerful Predictive Analytics with
- 北大tensorflow学习笔记
- LSTMandRNN.zip
- 使用TensorFlow搭建智能开发系统,自动
- Packt.TensorFlow.Machine.Learning.Cookbook.201
- tensorflow深度学习CNN智能识别车牌
- Tensorflow GNN实战.zip
- tensorflow从入门到精通
- 深度卷积生成对抗网络TensorFlow代码实
- TensorFlow_中文手册
- siamese mnist 孪生网络
- TensorFlow 中文文档 1.8 掘金 2018.5.19
- Tensorflow(一)训练自己的数据集——
评论
共有 条评论