TensorFlow教程之API DOC 6.1.1Class tensorflow::Env

简介:

本文档为TensorFlow参考文档,本转载已得到TensorFlow中文社区授权。


Class tensorflow::Env

An interface used by the tensorflow implementation to access operating system functionality like the filesystem etc.

Callers may wish to provide a custom Env object to get fine grain control.

All Env implementations are safe for concurrent access from multiple threads without any external synchronization.

Member Summary

Member Details

tensorflow::Env::Env()

virtual tensorflow::Env::~Env()

virtual Status tensorflow::Env::NewRandomAccessFile(const string &fname, RandomAccessFile **result)=0

Creates a brand new random access read-only file with the specified name.

On success, stores a pointer to the new file in result and returns OK. On failure stores NULL in result and returns non-OK. If the file does not exist, returns a non-OK status.

The returned file may be concurrently accessed by multiple threads.

virtual Status tensorflow::Env::NewWritableFile(const string &fname, WritableFile **result)=0

Creates an object that writes to a new file with the specified name.

Deletes any existing file with the same name and creates a new file. On success, stores a pointer to the new file in result and returns OK. On failure stores NULL in result and returns non-OK.

The returned file will only be accessed by one thread at a time.

virtual Status tensorflow::Env::NewAppendableFile(const string &fname, WritableFile **result)=0

Creates an object that either appends to an existing file, or writes to a new file (if the file does not exist to begin with).

On success, stores a pointer to the new file in result and returns OK. On failure stores NULL in result and returns non-OK.

The returned file will only be accessed by one thread at a time.

virtual bool tensorflow::Env::FileExists(const string &fname)=0

Returns true iff the named file exists.

virtual Status tensorflow::Env::GetChildren(const string &dir, std::vector< string > *result)=0

Stores in *result the names of the children of the specified directory. The names are relative to "dir".

Original contents of *results are dropped.

virtual Status tensorflow::Env::DeleteFile(const string &fname)=0

Deletes the named file.

virtual Status tensorflow::Env::CreateDir(const string &dirname)=0

Creates the specified directory.

virtual Status tensorflow::Env::DeleteDir(const string &dirname)=0

Deletes the specified directory.

virtual Status tensorflow::Env::GetFileSize(const string &fname, uint64 *file_size)=0

Stores the size of fname in *file_size.

virtual Status tensorflow::Env::RenameFile(const string &src, const string &target)=0

Renames file src to target. If target already exists, it will be replaced.

virtual uint64 tensorflow::Env::NowMicros()=0

Returns the number of micro-seconds since some fixed point in time. Only useful for computing deltas of time.

virtual void tensorflow::Env::SleepForMicroseconds(int micros)=0

Sleeps/delays the thread for the prescribed number of micro-seconds.

virtual Thread* tensorflow::Env::StartThread(const ThreadOptions &thread_options, const string &name, std::function< void()> fn) TF_MUST_USE_RESULT=0

Returns a new thread that is running fn() and is identified (for debugging/performance-analysis) by "name".

Caller takes ownership of the result and must delete it eventually (the deletion will block until fn() stops running).

static Env* tensorflow::Env::Default()

Returns a default environment suitable for the current operating system.

Sophisticated users may wish to provide their own Env implementation instead of relying on this default environment.

The result of Default() belongs to this library and must never be deleted.

相关文章
|
2月前
|
数据采集 监控 安全
各种业务场景调用API代理的API接口教程
API代理的API接口在各种业务场景中具有广泛的应用,本文将介绍哪些业务场景可以使用API代理的API接口,并提供详细的调用教程和代码演示,同时,我们还将讨论在不同场景下使用API代理的API接口所带来的好处。
|
5月前
|
机器学习/深度学习 JSON JavaScript
图文讲解 Stable Diffusion API 调用教程
Stable Diffusion 是一个先进的深度学习模型,用于创造和修改图像。这个模型能够基于文本描述来生成图像,让机器理解和实现用户的创意。使用这项技术的关键在于掌握其 API,通过编程来操控图像生成的过程。
|
23天前
|
机器学习/深度学习 API TensorFlow
TensorFlow的高级API:tf.keras深度解析
【4月更文挑战第17天】本文深入解析了TensorFlow的高级API `tf.keras`,包括顺序模型和函数式API的模型构建,以及模型编译、训练、评估和预测的步骤。`tf.keras`结合了Keras的易用性和TensorFlow的性能,支持回调函数、模型保存与加载等高级特性,助力提升深度学习开发效率。
|
2月前
|
安全 API 数据安全/隐私保护
email api接口配置教程步骤详解
Email API是用于程序化访问邮件服务的工具,让开发者能集成邮件功能到应用中。配置Email API包括选择供应商(如SendGrid、Mailgun、AokSend),注册获取API密钥,配置API参数,及测试邮件发送。使用Email API能提升邮件发送的可靠性和效率,便于邮件管理及营销活动。AokSend支持大量验证码发送,适合高效邮件运营。
|
3月前
|
存储 负载均衡 API
部署大模型API的实战教程
部署大模型API的实战教程可以分为以下步骤:
|
3月前
|
机器学习/深度学习 人工智能 API
人工智能应用工程师技能提升系列2、——TensorFlow2——keras高级API训练神经网络模型
人工智能应用工程师技能提升系列2、——TensorFlow2——keras高级API训练神经网络模型
38 0
|
5月前
|
存储 API 数据安全/隐私保护
2021年最新最全Flink系列教程__Flink高级API(四)
2021年最新最全Flink系列教程__Flink高级API(四)
36 0
|
4月前
|
机器学习/深度学习 Dart TensorFlow
TensorFlow Lite,ML Kit 和 Flutter 移动深度学习:6~11(5)
TensorFlow Lite,ML Kit 和 Flutter 移动深度学习:6~11(5)
75 0
|
1天前
|
机器学习/深度学习 TensorFlow 算法框架/工具
Python深度学习基于Tensorflow(7)视觉处理基础
Python深度学习基于Tensorflow(7)视觉处理基础
16 2
Python深度学习基于Tensorflow(7)视觉处理基础
|
1天前
|
机器学习/深度学习 算法 TensorFlow
Python深度学习基于Tensorflow(6)神经网络基础
Python深度学习基于Tensorflow(6)神经网络基础
15 2
Python深度学习基于Tensorflow(6)神经网络基础