-
大小: 20KB文件类型: .rar金币: 1下载: 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多级菜单的实现
相关资源
- 遥感影像场景识别tensorflow-CNN
- 完整用CNN(Tensorflow)完成文本分类的
- 《tensorflow实战》的源代码
- 在github上面的一些关于深度学习的项
- 鸢尾花 softmax tensorflow
- Tensorflow程序
- (WGAN、WGAN_gp)Wasseratein GAN
- CGANConditional Generative Adversarial Nets
- tensorflow识别花朵
- keras tensorflow lstm 多变量序列的预测
- 基于TensorFlow的Faster_R-CNN源码
- 在TensorFlow框架下实现DBN网络源码
- Tensorflow垃圾邮件分类
- TensorFlow视频教程
- tensorflow实现猫狗识别
- 双线性池化Bilinear poolingtensorflow版
- tensorflow 1.3 lstm训练和预测铁路客运数
- Tensorflow
- yolov1的tensorflow实现
- 基于Tensorflow实现BNBatch Normalization的代
- Tensorflow下构建LSTM模型
- 利用tensorflow实现3DCNN
- TensorFlow安装错误解决:ImportError: DL
- tensorflow-2.1.0-cp36-cp36m-win_amd64.whl
- tensorflow_gpu-2.1.0-cp37-cp37m-win_amd64.whl
- tensorflow的安装、图像识别应用、训练
- Opencv+Tensorflow入门人工智能处理无密完
- tensorflow下手写汉字识别及其可视化代
- tensorflow+inceptionv3网络
- tensorflow1.12.0+gpucuda 9.0
评论
共有 条评论