python中summary_Python summary_pb2.Summary方法代码示例
本文整理汇总了Python中tensorflow.core.framework.summary_pb2.Summary方法的典型用法代码示例。如果您正苦于以下问题:Python summary_pb2.Summary方法的具体用法?Python summary_pb2.Summary怎么用?Python summary_pb2.Summary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块tensorflow.core.framework.summary_pb2的用法示例。
在下文中一共展示了summary_pb2.Summary方法的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: add_summary
点赞 6
# 需要导入模块: from tensorflow.core.framework import summary_pb2 [as 别名]
# 或者: from tensorflow.core.framework.summary_pb2 import Summary [as 别名]
def add_summary(self, summary, global_step=None):
"""Adds a `Summary` protocol buffer to the event file.
This method wraps the provided summary in an `Event` protocol buffer
and adds it to the event file.
You can pass the result of evaluating any summary op, using
@{tf.Session.run} or
@{tf.Tensor.eval}, to this
function. Alternatively, you can pass a `tf.Summary` protocol
buffer that you populate with your own data. The latter is
commonly done to report evaluation results in event files.
Args:
summary: A `Summary` protocol buffer, optionally serialized as a string.
global_step: Number. Optional global step value to record with the
summary.
"""
if isinstance(summary, bytes):
summ = summary_pb2.Summary()
summ.ParseFromString(summary)
summary = summ
event = event_pb2.Event(summary=summary)
self._add_event(event, global_step)
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:26,
示例2: _write_summary_results
点赞 6
# 需要导入模块: from tensorflow.core.framework import summary_pb2 [as 别名]
# 或者: from tensorflow.core.framework.summary_pb2 import Summary [as 别名]
def _write_summary_results(output_dir, eval_results, current_global_step):
"""Writes eval results into summary file in given dir."""
logging.info('Saving evaluation summary for step %d: %s', current_global_step,
_eval_results_to_str(eval_results))
summary_writer = get_summary_writer(output_dir)
summary = summary_pb2.Summary()
for key in eval_results:
if eval_results[key] is None:
continue
value = summary.value.add()
value.tag = key
if (isinstance(eval_results[key], np.float32) or
isinstance(eval_results[key], float)):
value.simple_value = float(eval_results[key])
else:
logging.warn('Skipping summary for %s, must be a float or np.float32.',
key)
summary_writer.add_summary(summary, current_global_step)
summary_writer.flush()
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:21,
示例3: assert_summary
点赞 6
# 需要导入模块: from tensorflow.core.framework import summary_pb2 [as 别名]
# 或者: from tensorflow.core.framework.summary_pb2 import Summary [as 别名]
def assert_summary(expected_tags, expected_simple_values, summary_proto):
"""Asserts summary contains the specified tags and values.
Args:
expected_tags: All tags in summary.
expected_simple_values: Simply values for some tags.
summary_proto: Summary to validate.
Raises:
ValueError: if expectations are not met.
"""
actual_tags = set()
for value in summary_proto.value:
actual_tags.add(value.tag)
if value.tag in expected_simple_values:
expected = expected_simple_values[value.tag]
actual = value.simple_value
np.testing.assert_almost_equal(
actual, expected, decimal=2, err_msg=value.tag)
expected_tags = set(expected_tags)
if expected_tags != actual_tags:
raise ValueError('Expected tags %s, got %s.' % (expected_tags, actual_tags))
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:24,
示例4: to_summary_proto
点赞 6
# 需要导入模块: from tensorflow.core.framework import summary_pb2 [as 别名]
# 或者: from tensorflow.core.framework.summary_pb2 import Summary [as 别名]
def to_summary_proto(summary_str):
"""Create summary based on latest stats.
Args:
summary_str: Serialized summary.
Returns:
summary_pb2.Summary.
Raises:
ValueError: if tensor is not a valid summary tensor.
"""
summary = summary_pb2.Summary()
summary.ParseFromString(summary_str)
return summary
# TODO(ptucker): Move to a non-test package?
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:18,
示例5: add_summary
点赞 6
# 需要导入模块: from tensorflow.core.framework import summary_pb2 [as 别名]
# 或者: from tensorflow.core.framework.summary_pb2 import Summary [as 别名]
def add_summary(self, summary, global_step=None):
"""Adds a `Summary` protocol buffer to the event file.
This method wraps the provided summary in an `Event` protocol buffer
and adds it to the event file.
You can pass the result of evaluating any summary op, using
[`Session.run()`](client.md#Session.run) or
[`Tensor.eval()`](framework.md#Tensor.eval), to this
function. Alternatively, you can pass a `tf.Summary` protocol
buffer that you populate with your own data. The latter is
commonly done to report evaluation results in event files.
Args:
summary: A `Summary` protocol buffer, optionally serialized as a string.
global_step: Number. Optional global step value to record with the
summary.
"""
if isinstance(summary, bytes):
summ = summary_pb2.Summary()
summ.ParseFromString(summary)
summary = summ
event = event_pb2.Event(summary=summary)
self._add_event(event, global_step)
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:26,
示例6: _WriteScalarSummaries
点赞 6
# 需要导入模块: from tensorflow.core.framework import summary_pb2 [as 别名]
# 或者: from tensorflow.core.framework.summary_pb2 import Summary [as 别名]
def _WriteScalarSummaries(self, data, subdirs=('',)):
# Writes data to a tempfile in subdirs, and returns generator for the data.
# If subdirs is given, writes data identically to all subdirectories.
for subdir_ in subdirs:
subdir = os.path.join(self.logdir, subdir_)
self._MakeDirectoryIfNotExists(subdir)
sw = SummaryWriter(subdir)
for datum in data:
summary = Summary()
if 'simple_value' in datum:
summary.value.add(tag=datum['tag'],
simple_value=datum['simple_value'])
sw.add_summary(summary, global_step=datum['step'])
elif 'histo' in datum:
summary.value.add(tag=datum['tag'], histo=HistogramProto())
sw.add_summary(summary, global_step=datum['step'])
elif 'session_log' in datum:
sw.add_session_log(datum['session_log'], global_step=datum['step'])
sw.close()
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:22,
示例7: merge_TFSummary
点赞 6
# 需要导入模块: from tensorflow.core.framework import summary_pb2 [as 别名]
# 或者: from tensorflow.core.framework.summary_pb2 import Summary [as 别名]
def merge_TFSummary(summary_list, weights):
merged_values = {}
weight_sum_map = {}
for i in range(len(summary_list)):
summary = summary_list[i]
if isinstance(summary, bytes):
parse_TFSummary_from_bytes(summary)
summ = summary_pb2.Summary()
summ.ParseFromString(summary)
summary = summ
for e in summary.value:
if e.tag not in merged_values:
merged_values[e.tag] = 0.0
weight_sum_map[e.tag] = 0.0
merged_values[e.tag] += e.simple_value * weights[i]
weight_sum_map[e.tag] += weights[i]
for k in merged_values:
merged_values[k] /= max(0.0000001, weight_sum_map[k])
return tf.Summary(value=[
tf.Summary.Value(tag=k, simple_value=merged_values[k]) for k in merged_values
])
开发者ID:ULTR-Community,项目名称:ULTRA,代码行数:23,
示例8: _assert_simple_summaries
点赞 6
# 需要导入模块: from tensorflow.core.framework import summary_pb2 [as 别名]
# 或者: from tensorflow.core.framework.summary_pb2 import Summary [as 别名]
def _assert_simple_summaries(test_case,
expected_summaries,
summary_str,
tol=1e-6):
"""Assert summary the specified simple values.
Args:
test_case: test case.
expected_summaries: Dict of expected tags and simple values.
summary_str: Serialized `summary_pb2.Summary`.
tol: Tolerance for relative and absolute.
"""
summary = summary_pb2.Summary()
summary.ParseFromString(summary_str)
test_case.assertAllClose(
expected_summaries, {v.tag: v.simple_value for v in summary.value},
rtol=tol,
atol=tol)
开发者ID:tensorflow,项目名称:estimator,代码行数:20,
示例9: _write_checkpoint_path_to_summary
点赞 6
# 需要导入模块: from tensorflow.core.framework import summary_pb2 [as 别名]
# 或者: from tensorflow.core.framework.summary_pb2 import Summary [as 别名]
def _write_checkpoint_path_to_summary(output_dir, checkpoint_path,
current_global_step):
"""Writes `checkpoint_path` into summary file in the given output directory.
Args:
output_dir: `str`, directory to write the summary file in.
checkpoint_path: `str`, checkpoint file path to be written to summary file.
current_global_step: `int`, the current global step.
"""
checkpoint_path_tag = 'checkpoint_path'
tf.compat.v1.logging.info('Saving \'%s\' summary for global step %d: %s',
checkpoint_path_tag, current_global_step,
checkpoint_path)
summary_proto = summary_pb2.Summary()
summary_proto.value.add(
tag=checkpoint_path_tag,
tensor=tf.make_tensor_proto(checkpoint_path, dtype=tf.dtypes.string))
summary_writer = tf.compat.v1.summary.FileWriterCache.get(output_dir)
summary_writer.add_summary(summary_proto, current_global_step)
summary_writer.flush()
开发者ID:tensorflow,项目名称:estimator,代码行数:24,
示例10: _AddRateToSummary
点赞 5
# 需要导入模块: from tensorflow.core.framework import summary_pb2 [as 别名]
# 或者: from tensorflow.core.framework.summary_pb2 import Summary [as 别名]
def _AddRateToSummary(tag, rate, step, sw):
"""Adds the given rate to the summary with the given tag.
Args:
tag: Name for this value.
rate: Value to add to the summary. Perhaps an error rate.
step: Global step of the graph for the x-coordinate of the summary.
sw: Summary writer to which to write the rate value.
"""
sw.add_summary(
summary_pb2.Summary(value=[summary_pb2.Summary.Value(
tag=tag, simple_value=rate)]), step)
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:14,
示例11: make_summary
点赞 5
# 需要导入模块: from tensorflow.core.framework import summary_pb2 [as 别名]
# 或者: from tensorflow.core.framework.summary_pb2 import Summary [as 别名]
def make_summary(name, val):
return summary_pb2.Summary(value=[summary_pb2.Summary.Value(tag=name, simple_value=val)])
开发者ID:mkocaoglu,项目名称:CausalGAN,代码行数:4,
示例12: _write_dict_to_summary
点赞 5
# 需要导入模块: from tensorflow.core.framework import summary_pb2 [as 别名]
# 或者: from tensorflow.core.framework.summary_pb2 import Summary [as 别名]
def _write_dict_to_summary(output_dir,
dictionary,
current_global_step):
"""Writes a `dict` into summary file in given output directory.
Args:
output_dir: `str`, directory to write the summary file in.
dictionary: the `dict` to be written to summary file.
current_global_step: `int`, the current global step.
"""
logging.info('Saving dict for global step %d: %s', current_global_step,
_dict_to_str(dictionary))
summary_writer = writer_cache.FileWriterCache.get(output_dir)
summary_proto = summary_pb2.Summary()
for key in dictionary:
if dictionary[key] is None:
continue
if key == "global_step":
continue
value = summary_proto.value.add()
value.tag = key
if (isinstance(dictionary[key], np.float32) or
isinstance(dictionary[key], float)):
value.simple_value = float(dictionary[key])
elif (isinstance(dictionary[key], np.int64) or
isinstance(dictionary[key], np.int32) or
isinstance(dictionary[key], int)):
value.simple_value = int(dictionary[key])
else:
logging.warn('Skipping summary for %s, must be a float, np.float32, np.int64, np.int32 or int.',
key)
summary_writer.add_summary(summary_proto, current_global_step)
summary_writer.flush()
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:35,
示例13: add_summary
点赞 5
# 需要导入模块: from tensorflow.core.framework import summary_pb2 [as 别名]
# 或者: from tensorflow.core.framework.summary_pb2 import Summary [as 别名]
def add_summary(self, summary, global_step=None):
"""Adds a `Summary` protocol buffer to the event file.
This method wraps the provided summary in an `Event` protocol buffer
and adds it to the event file.
You can pass the result of evaluating any summary op, using
@{tf.Session.run} or
@{tf.Tensor.eval}, to this
function. Alternatively, you can pass a `tf.Summary` protocol
buffer that you populate with your own data. The latter is
commonly done to report evaluation results in event files.
Args:
summary: A `Summary` protocol buffer, optionally serialized as a string.
global_step: Number. Optional global step value to record with the
summary.
"""
if isinstance(summary, bytes):
summ = summary_pb2.Summary()
summ.ParseFromString(summary)
summary = summ
event = event_pb2.Event(wall_time=time.time(), summary=summary)
if global_step is not None:
event.step = int(global_step)
self.add_event(event)
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:28,
示例14: add_summary
点赞 5
# 需要导入模块: from tensorflow.core.framework import summary_pb2 [as 别名]
# 或者: from tensorflow.core.framework.summary_pb2 import Summary [as 别名]
def add_summary(self, summ, current_global_step):
"""Add summary."""
if isinstance(summ, bytes):
summary_proto = summary_pb2.Summary()
summary_proto.ParseFromString(summ)
summ = summary_proto
if current_global_step in self._summaries:
step_summaries = self._summaries[current_global_step]
else:
step_summaries = []
self._summaries[current_global_step] = step_summaries
step_summaries.append(summ)
# NOTE: Ignore global_step since its value is non-deterministic.
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:16,
示例15: simple_values_from_events
点赞 5
# 需要导入模块: from tensorflow.core.framework import summary_pb2 [as 别名]
# 或者: from tensorflow.core.framework.summary_pb2 import Summary [as 别名]
def simple_values_from_events(events, tags):
"""Parse summaries from events with simple_value.
Args:
events: List of tensorflow.Event protos.
tags: List of string event tags corresponding to simple_value summaries.
Returns:
dict of tag:value.
Raises:
ValueError: if a summary with a specified tag does not contain simple_value.
"""
step_by_tag = {}
value_by_tag = {}
for e in events:
if e.HasField('summary'):
for v in e.summary.value:
tag = v.tag
if tag in tags:
if not v.HasField('simple_value'):
raise ValueError('Summary for %s is not a simple_value.' % tag)
# The events are mostly sorted in step order, but we explicitly check
# just in case.
if tag not in step_by_tag or e.step > step_by_tag[tag]:
step_by_tag[tag] = e.step
value_by_tag[tag] = v.simple_value
return value_by_tag
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:28,
示例16: _parse_summary_if_needed
点赞 5
# 需要导入模块: from tensorflow.core.framework import summary_pb2 [as 别名]
# 或者: from tensorflow.core.framework.summary_pb2 import Summary [as 别名]
def _parse_summary_if_needed(summary):
"""
Parses the summary if it is provided in serialized form (bytes).
This code is copied from tensorflow's SummaryToEventTransformer::add_summary
:param summary:
:return:
"""
if isinstance(summary, bytes):
summ = summary_pb2.Summary()
summ.ParseFromString(summary)
summary = summ
return summary
开发者ID:rlgraph,项目名称:rlgraph,代码行数:14,
示例17: add_summary
点赞 5
# 需要导入模块: from tensorflow.core.framework import summary_pb2 [as 别名]
# 或者: from tensorflow.core.framework.summary_pb2 import Summary [as 别名]
def add_summary(self, summary, global_step=None):
"""Adds a `Summary` protocol buffer to the event file.
This method wraps the provided summary in an `Event` protocol buffer
and adds it to the event file.
You can pass the result of evaluating any summary op, using
[`Session.run()`](client.md#Session.run) or
[`Tensor.eval()`](framework.md#Tensor.eval), to this
function. Alternatively, you can pass a `tf.Summary` protocol
buffer that you populate with your own data. The latter is
commonly done to report evaluation results in event files.
Args:
summary: A `Summary` protocol buffer, optionally serialized as a string.
global_step: Number. Optional global step value to record with the
summary.
"""
if isinstance(summary, bytes):
summ = summary_pb2.Summary()
summ.ParseFromString(summary)
summary = summ
event = event_pb2.Event(wall_time=time.time(), summary=summary)
if global_step is not None:
event.step = int(global_step)
self.add_event(event)
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:28,
示例18: _write_dict_to_summary
点赞 5
# 需要导入模块: from tensorflow.core.framework import summary_pb2 [as 别名]
# 或者: from tensorflow.core.framework.summary_pb2 import Summary [as 别名]
def _write_dict_to_summary(output_dir,
dictionary,
current_global_step):
"""Writes a `dict` into summary file in given output directory.
Args:
output_dir: `str`, directory to write the summary file in.
dictionary: the `dict` to be written to summary file.
current_global_step: `int`, the current global step.
"""
logging.info('Saving dict for global step %d: %s', current_global_step,
_dict_to_str(dictionary))
summary_writer = summary_io.SummaryWriterCache.get(output_dir)
summary_proto = summary_pb2.Summary()
for key in dictionary:
if dictionary[key] is None:
continue
value = summary_proto.value.add()
value.tag = key
if (isinstance(dictionary[key], np.float32) or
isinstance(dictionary[key], float)):
value.simple_value = float(dictionary[key])
else:
logging.warn('Skipping summary for %s, must be a float or np.float32.',
key)
summary_writer.add_summary(summary_proto, current_global_step)
summary_writer.flush()
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:29,
注:本文中的tensorflow.core.framework.summary_pb2.Summary方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。
python中summary_Python summary_pb2.Summary方法代码示例相关推荐
- python中permute_Python layers.Permute方法代码示例
本文整理汇总了Python中keras.layers.Permute方法的典型用法代码示例.如果您正苦于以下问题:Python layers.Permute方法的具体用法?Python layers. ...
- python中shelf_Python cmds.shelfLayout方法代码示例
本文整理汇总了Python中maya.cmds.shelfLayout方法的典型用法代码示例.如果您正苦于以下问题:Python cmds.shelfLayout方法的具体用法?Python cmds ...
- python中weekday_Python calendar.weekday方法代码示例
本文整理汇总了Python中calendar.weekday方法的典型用法代码示例.如果您正苦于以下问题:Python calendar.weekday方法的具体用法?Python calendar. ...
- python中close_Python pool.close方法代码示例
本文整理汇总了Python中multiprocessing.pool.close方法的典型用法代码示例.如果您正苦于以下问题:Python pool.close方法的具体用法?Python pool. ...
- python中callable_Python abc.Callable方法代码示例
本文整理汇总了Python中collections.abc.Callable方法的典型用法代码示例.如果您正苦于以下问题:Python abc.Callable方法的具体用法?Python abc.C ...
- python中rcparams_Python pylab.rcParams方法代码示例
# 需要导入模块: from matplotlib import pylab [as 别名] # 或者: from matplotlib.pylab import rcParams [as 别名] d ...
- python中opener_Python request.build_opener方法代码示例
# 需要导入模块: from six.moves.urllib import request [as 别名] # 或者: from six.moves.urllib.request import bu ...
- doc python 颜色_Python wordcloud.ImageColorGenerator方法代码示例
本文整理汇总了Python中wordcloud.ImageColorGenerator方法的典型用法代码示例.如果您正苦于以下问题:Python wordcloud.ImageColorGenerat ...
- python asyncio future_Python asyncio.isfuture方法代码示例
本文整理汇总了Python中asyncio.isfuture方法的典型用法代码示例.如果您正苦于以下问题:Python asyncio.isfuture方法的具体用法?Python asyncio.i ...
最新文章
- 使用AD8302进行检波
- JavaScript 笔记(2) -- 类型转换 正则表达 变量提升 表单验证
- 使用Eclipse PDT + Xampp搭建Php开发环境
- jsr-303 参数校验-学习(转)
- JavaWeb 项目时 启动一个线程
- 客户端控件Javascript验证类
- MSSql与MYSQL比较
- 如何给Exadata数据库一体机打补丁patching图解
- iMX6QD How to Add 24-bit LVDS Support in Android
- 智慧化工园区解决方案
- 自己搭建虚拟服务器,如何自己搭建虚拟主机
- 一步一步排查真实拍图片不能上传的问题
- 【模电知识总结】MOS管
- 逍遥魔兽mysql_隆重推出【逍遥魔兽V837】端带全新一键端工具
- 研究生真正需要培养的五大能力
- 复数乘法(JAVA)
- 微软提前发新版音乐播放器 阻击苹果新iPod
- 制作 ESXI6.7 U盘安装盘
- 利用wrk工具压测腾讯CLB
- windows安装.Net Framework3.5无法安装问题
热门文章
- 乐视2 pro2 IMAX手机root权限 刷rece 解锁 刷系统等
- 头哥实践教学平台 CC++程序设计(计算机程序设计)基本输入输出 第2关:整数四则运算表达式的输出格式控制
- 火狐浏览器打开发现是2345的网站-----解决方法
- android主题设置
- 美团热修复 Android适配,美团热修复Robust用法和实践
- dos命令之 assoc 用法详解
- Android java.lang.IllegalStateException: Underflow in restore - more restores than saves
- 【软考四】软件知识产权基础知识(做题)
- 在word中10秒一键将900个mathtype公式转换成word自带公式--GrindEQ公式转换神器
- DPDK内存(二)内存申请操作