codecamp

解析Example原型:tf.parse_single_example

tf.parse_single_example 函数
parse_single_example(
    serialized,
    features,
    name=None,
    example_names=None
)

定义在:tensorflow/python/ops/parsing_ops.py.

请参阅指南:输入和读取器>协议缓冲区示例

解析单个 Example 原型.

类似于操作 parse_example,除了:

对于稠密张量,返回的 Tensor 是与 parse_example 的输出相同,除了没有批处理维度,输出形状与 dense_shape 中给定的形状相同.

对于 SparseTensors,索引矩阵的第一(批)列被移除(索引矩阵是一个列向量),值向量不变,并且形状向量的第一个(batch_size)项被移除(它现在是单个元素向量).

有人可能会看到性能上的优势Example,parse_example而不是直接使用这个函数. 我们可以通过将 Example 原型与 parse_example 进行批处理来查看性能优势,而不是直接使用这个函数.

参数:

  • serialized:一个标量字符串张量,单个序列化的例子.请参阅 _parse_single_example_raw 文档了解更多详情.
  • features:一个 dict,映射功能键到 FixedLenFeature 或 VarLenFeature值.
  • name:此操作的名称(可选).
  • example_names:(可选)标量字符串张量,关联的名称.请参阅 _parse_single_example_raw 文档了解更多详情.

返回:

一个 dict,映射功能键到 Tensor 和 SparseTensor 值.

可能引发的异常:

  • ValueError:如果有任何功能无效.
TensorFlow函数:tf.parallel_stack
TensorFlow占位符:tf.placeholder
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

TensorFlow 函数介绍

TensorFlow 函数模块:tf

TensorFlow的image模块

TensorFlow使用之tf.io

TensorFlow使用之tf.keras

TensorFlow函数教程:tf.keras.applications

TensorFlow函数教程:tf.keras.backend

TensorFlow使用之tf.metrics

TensorFlow使用之tf.nn

TensorFlow使用之tf.python_io

TensorFlow 功能函数

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }