codecamp

TensorFlow函数教程:tf.io.TFRecordWriter

tf.io.TFRecordWriter函数

类 TFRecordWriter

别名:

  • 类 tf.io.TFRecordWriter
  • 类 tf.python_io.TFRecordWriter

定义在:tensorflow/python/lib/io/tf_record.py。

将记录写入TFRecords文件的类。

此类实现__enter__和__exit__,并且可以像普通文件一样在with块中使用。


__init__

__init__(
    path,
    options=None
)

打开path文件并创建一个写入它的TFRecordWriter。

参数:


  • path:TFRecords文件的路径。
  • options:(可选)指定压缩类型,TFRecordCompressionType或TFRecordOptions对象的字符串 。

可能引发的异常:

  • IOError:如果无法打开path进行写入。
  • ValueError:如果无法从options确定有效的compression_type。

方法

__enter__

__enter__()

输入一个with块 block。



__exit__

__exit__(
    unused_type,
    unused_value,
    unused_traceback
)

退出一个block,关闭文件。




close

close()

关闭文件。



flush

flush()

刷新文件。



write

write(record)

将字符串记录写入文件。



参数:

  • record:str


TensorFlow函数教程:tf.io.TFRecordOptions
TensorFlow函数教程:tf.io.tf_record_iterator
温馨提示
下载编程狮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; }