|
| 1 | +# Class `tensorflow::Env` <a class="md-anchor" id="AUTOGENERATED-class--tensorflow--env-"></a> |
| 2 | + |
| 3 | +An interface used by the tensorflow implementation to access operating system functionality like the filesystem etc. |
| 4 | + |
| 5 | +Callers may wish to provide a custom Env object to get fine grain control. |
| 6 | + |
| 7 | +All Env implementations are safe for concurrent access from multiple threads without any external synchronization. |
| 8 | + |
| 9 | +##Member Summary <a class="md-anchor" id="AUTOGENERATED-member-summary"></a> |
| 10 | + |
| 11 | +* [`tensorflow::Env::Env()`](#tensorflow_Env_Env) |
| 12 | +* [`virtual tensorflow::Env::~Env()`](#virtual_tensorflow_Env_Env) |
| 13 | +* [`virtual Status tensorflow::Env::NewRandomAccessFile(const string &fname, RandomAccessFile **result)=0`](#virtual_Status_tensorflow_Env_NewRandomAccessFile) |
| 14 | + * Creates a brand new random access read-only file with the specified name. |
| 15 | +* [`virtual Status tensorflow::Env::NewWritableFile(const string &fname, WritableFile **result)=0`](#virtual_Status_tensorflow_Env_NewWritableFile) |
| 16 | + * Creates an object that writes to a new file with the specified name. |
| 17 | +* [`virtual Status tensorflow::Env::NewAppendableFile(const string &fname, WritableFile **result)=0`](#virtual_Status_tensorflow_Env_NewAppendableFile) |
| 18 | + * 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). |
| 19 | +* [`virtual bool tensorflow::Env::FileExists(const string &fname)=0`](#virtual_bool_tensorflow_Env_FileExists) |
| 20 | + * Returns true iff the named file exists. |
| 21 | +* [`virtual Status tensorflow::Env::GetChildren(const string &dir, std::vector< string > *result)=0`](#virtual_Status_tensorflow_Env_GetChildren) |
| 22 | + * Stores in *result the names of the children of the specified directory. The names are relative to "dir". |
| 23 | +* [`virtual Status tensorflow::Env::DeleteFile(const string &fname)=0`](#virtual_Status_tensorflow_Env_DeleteFile) |
| 24 | + * Deletes the named file. |
| 25 | +* [`virtual Status tensorflow::Env::CreateDir(const string &dirname)=0`](#virtual_Status_tensorflow_Env_CreateDir) |
| 26 | + * Creates the specified directory. |
| 27 | +* [`virtual Status tensorflow::Env::DeleteDir(const string &dirname)=0`](#virtual_Status_tensorflow_Env_DeleteDir) |
| 28 | + * Deletes the specified directory. |
| 29 | +* [`virtual Status tensorflow::Env::GetFileSize(const string &fname, uint64 *file_size)=0`](#virtual_Status_tensorflow_Env_GetFileSize) |
| 30 | + * Stores the size of fname in *file_size. |
| 31 | +* [`virtual Status tensorflow::Env::RenameFile(const string &src, const string &target)=0`](#virtual_Status_tensorflow_Env_RenameFile) |
| 32 | + * Renames file src to target. If target already exists, it will be replaced. |
| 33 | +* [`virtual uint64 tensorflow::Env::NowMicros()=0`](#virtual_uint64_tensorflow_Env_NowMicros) |
| 34 | + * Returns the number of micro-seconds since some fixed point in time. Only useful for computing deltas of time. |
| 35 | +* [`virtual void tensorflow::Env::SleepForMicroseconds(int micros)=0`](#virtual_void_tensorflow_Env_SleepForMicroseconds) |
| 36 | + * Sleeps/delays the thread for the prescribed number of micro-seconds. |
| 37 | +* [`virtual Thread* tensorflow::Env::StartThread(const ThreadOptions &thread_options, const string &name, std::function< void()> fn) TF_MUST_USE_RESULT=0`](#virtual_Thread_tensorflow_Env_StartThread) |
| 38 | + * Returns a new thread that is running fn() and is identified (for debugging/performance-analysis) by "name". |
| 39 | +* [`static Env* tensorflow::Env::Default()`](#static_Env_tensorflow_Env_Default) |
| 40 | + * Returns a default environment suitable for the current operating system. |
| 41 | + |
| 42 | +##Member Details <a class="md-anchor" id="AUTOGENERATED-member-details"></a> |
| 43 | + |
| 44 | +#### `tensorflow::Env::Env()` <a class="md-anchor" id="tensorflow_Env_Env"></a> |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | +#### `virtual tensorflow::Env::~Env()` <a class="md-anchor" id="virtual_tensorflow_Env_Env"></a> |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | +#### `virtual Status tensorflow::Env::NewRandomAccessFile(const string &fname, RandomAccessFile **result)=0` <a class="md-anchor" id="virtual_Status_tensorflow_Env_NewRandomAccessFile"></a> |
| 57 | + |
| 58 | +Creates a brand new random access read-only file with the specified name. |
| 59 | + |
| 60 | +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. |
| 61 | + |
| 62 | +The returned file may be concurrently accessed by multiple threads. |
| 63 | + |
| 64 | +#### `virtual Status tensorflow::Env::NewWritableFile(const string &fname, WritableFile **result)=0` <a class="md-anchor" id="virtual_Status_tensorflow_Env_NewWritableFile"></a> |
| 65 | + |
| 66 | +Creates an object that writes to a new file with the specified name. |
| 67 | + |
| 68 | +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. |
| 69 | + |
| 70 | +The returned file will only be accessed by one thread at a time. |
| 71 | + |
| 72 | +#### `virtual Status tensorflow::Env::NewAppendableFile(const string &fname, WritableFile **result)=0` <a class="md-anchor" id="virtual_Status_tensorflow_Env_NewAppendableFile"></a> |
| 73 | + |
| 74 | +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). |
| 75 | + |
| 76 | +On success, stores a pointer to the new file in *result and returns OK. On failure stores NULL in *result and returns non-OK. |
| 77 | + |
| 78 | +The returned file will only be accessed by one thread at a time. |
| 79 | + |
| 80 | +#### `virtual bool tensorflow::Env::FileExists(const string &fname)=0` <a class="md-anchor" id="virtual_bool_tensorflow_Env_FileExists"></a> |
| 81 | + |
| 82 | +Returns true iff the named file exists. |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | +#### `virtual Status tensorflow::Env::GetChildren(const string &dir, std::vector< string > *result)=0` <a class="md-anchor" id="virtual_Status_tensorflow_Env_GetChildren"></a> |
| 87 | + |
| 88 | +Stores in *result the names of the children of the specified directory. The names are relative to "dir". |
| 89 | + |
| 90 | +Original contents of *results are dropped. |
| 91 | + |
| 92 | +#### `virtual Status tensorflow::Env::DeleteFile(const string &fname)=0` <a class="md-anchor" id="virtual_Status_tensorflow_Env_DeleteFile"></a> |
| 93 | + |
| 94 | +Deletes the named file. |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | +#### `virtual Status tensorflow::Env::CreateDir(const string &dirname)=0` <a class="md-anchor" id="virtual_Status_tensorflow_Env_CreateDir"></a> |
| 99 | + |
| 100 | +Creates the specified directory. |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | +#### `virtual Status tensorflow::Env::DeleteDir(const string &dirname)=0` <a class="md-anchor" id="virtual_Status_tensorflow_Env_DeleteDir"></a> |
| 105 | + |
| 106 | +Deletes the specified directory. |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | +#### `virtual Status tensorflow::Env::GetFileSize(const string &fname, uint64 *file_size)=0` <a class="md-anchor" id="virtual_Status_tensorflow_Env_GetFileSize"></a> |
| 111 | + |
| 112 | +Stores the size of fname in *file_size. |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | +#### `virtual Status tensorflow::Env::RenameFile(const string &src, const string &target)=0` <a class="md-anchor" id="virtual_Status_tensorflow_Env_RenameFile"></a> |
| 117 | + |
| 118 | +Renames file src to target. If target already exists, it will be replaced. |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | +#### `virtual uint64 tensorflow::Env::NowMicros()=0` <a class="md-anchor" id="virtual_uint64_tensorflow_Env_NowMicros"></a> |
| 123 | + |
| 124 | +Returns the number of micro-seconds since some fixed point in time. Only useful for computing deltas of time. |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | +#### `virtual void tensorflow::Env::SleepForMicroseconds(int micros)=0` <a class="md-anchor" id="virtual_void_tensorflow_Env_SleepForMicroseconds"></a> |
| 129 | + |
| 130 | +Sleeps/delays the thread for the prescribed number of micro-seconds. |
| 131 | + |
| 132 | + |
| 133 | + |
| 134 | +#### `virtual Thread* tensorflow::Env::StartThread(const ThreadOptions &thread_options, const string &name, std::function< void()> fn) TF_MUST_USE_RESULT=0` <a class="md-anchor" id="virtual_Thread_tensorflow_Env_StartThread"></a> |
| 135 | + |
| 136 | +Returns a new thread that is running fn() and is identified (for debugging/performance-analysis) by "name". |
| 137 | + |
| 138 | +Caller takes ownership of the result and must delete it eventually (the deletion will block until fn() stops running). |
| 139 | + |
| 140 | +#### `static Env* tensorflow::Env::Default()` <a class="md-anchor" id="static_Env_tensorflow_Env_Default"></a> |
| 141 | + |
| 142 | +Returns a default environment suitable for the current operating system. |
| 143 | + |
| 144 | +Sophisticated users may wish to provide their own Env implementation instead of relying on this default environment. |
| 145 | + |
| 146 | +The result of Default() belongs to this library and must never be deleted. |
0 commit comments