Skip to content

Commit

Permalink
Update documentation for 0.11.0rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
yifeif committed Oct 19, 2016
1 parent 8d9eb8e commit ddf49b9
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 69 deletions.
36 changes: 35 additions & 1 deletion tensorflow/g3doc/api_docs/cc/ClassEnv.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,24 @@ Stores in *result the names of the children of the specified directory. The name

Original contents of *results are dropped.

#### `virtual bool tensorflow::Env::MatchPath(const string &path, const string &pattern)=0` {#virtual_bool_tensorflow_Env_MatchPath}

Returns true if the path matches the given pattern. The wildcards allowed in pattern are described below (GetMatchingPaths).



#### `Status tensorflow::Env::GetMatchingPaths(const string &pattern, std::vector< string > *results)` {#Status_tensorflow_Env_GetMatchingPaths}

Given a pattern, stores in *results the set of paths that matches that pattern. *results is cleared.

pattern must match all of a name, not just a substring. pattern: { term } term: &apos;*&apos;: matches any sequence of non-&apos;/&apos; characters &apos;?&apos;: matches a single non-&apos;/&apos; character &apos;[&apos; [ &apos;^&apos; ] { match-list } &apos;]&apos;: matches any single character (not) on the list c: matches character c (c != &apos;*&apos;, &apos;?&apos;, &apos;\&apos;, &apos;[&apos;) &apos;\&apos; c: matches character c character-range: c: matches character c (c != &apos;\&apos;, &apos;-&apos;, &apos;]&apos;) &apos;\&apos; c: matches character c lo &apos;-&apos; hi: matches character c for lo <= c <= hi

Typical return codes

OK - no errors

UNIMPLEMENTED - Some underlying functions (like GetChildren) are not implemented The default implementation uses a combination of GetChildren, MatchPath and IsDirectory.

#### `Status tensorflow::Env::DeleteFile(const string &fname)` {#Status_tensorflow_Env_DeleteFile}

Deletes the named file.
Expand All @@ -110,11 +128,27 @@ PERMISSION_DENIED - dirname or some descendant is not writable

UNIMPLEMENTED - Some underlying functions (like Delete) are not implemented

#### `Status tensorflow::Env::RecursivelyCreateDir(const string &dirname)` {#Status_tensorflow_Env_RecursivelyCreateDir}

Creates the specified directory and all the necessary subdirectories. Typical return codes.



OK - successfully created the directory and sub directories, even if they were already created.

PERMISSION_DENIED - dirname or some subdirectory is not writable.

#### `Status tensorflow::Env::CreateDir(const string &dirname)` {#Status_tensorflow_Env_CreateDir}

Creates the specified directory.
Creates the specified directory. Typical return codes.



OK - successfully created the directory.

ALREADY_EXISTS - directory already exists.

PERMISSION_DENIED - dirname is not writable.

#### `Status tensorflow::Env::DeleteDir(const string &dirname)` {#Status_tensorflow_Env_DeleteDir}

Expand Down
6 changes: 6 additions & 0 deletions tensorflow/g3doc/api_docs/cc/ClassEnvWrapper.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ Returns the file system schemes registered for this Env .



#### `bool tensorflow::EnvWrapper::MatchPath(const string &path, const string &pattern) override` {#bool_tensorflow_EnvWrapper_MatchPath}

Returns true if the path matches the given pattern. The wildcards allowed in pattern are described below (GetMatchingPaths).



#### `uint64 tensorflow::EnvWrapper::NowMicros() override` {#uint64_tensorflow_EnvWrapper_NowMicros}

Returns the number of micro-seconds since some fixed point in time. Only useful for computing deltas of time.
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/g3doc/api_docs/cc/ClassRandomAccessFile.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ A file abstraction for randomly reading the contents of a file.



#### `virtual Status tensorflow::RandomAccessFile::Read(uint64 offset, size_t n, StringPiece *result, char *scratch) const =0` {#virtual_Status_tensorflow_RandomAccessFile_Read}
#### `virtual Status tensorflow::RandomAccessFile::Read(uint64 offset, size_t n, StringPiece *result, char *scratch) const =0` {#virtual_Status_tensorflow_RandomAccessFile_Read}

Reads up to `n` bytes from the file starting at `offset`.

Expand Down
31 changes: 1 addition & 30 deletions tensorflow/g3doc/api_docs/cc/ClassSession.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,7 @@ When a Session is created with a given target, a new Session object is bound to

Example:

```c++ tensorflow::GraphDef graph;
// ... Create or load graph into "graph".

// This example uses the default options which connects
// to a local runtime.
tensorflow::SessionOptions options;
std::unique_ptr<tensorflow::Session>
session(tensorflow::NewSession(options));

// Create the session with this graph.
tensorflow::Status s = session->Create(graph);
if (!s.ok()) { ... }

// Run the graph and fetch the first output of the "output"
// operation, and also run to but do not return anything
// for the "update_state" operation.
std::vector<tensorflow::Tensor> outputs;
s = session->Run({}, {"output:0"}, {"update_state"}, &outputs);
if (!s.ok()) { ... }

// Map the output as a flattened float tensor, and do something
// with it.
auto output_tensor = outputs[0].flat<float>();
if (output_tensor(0) > 0.5) { ... }

// Close the session to release the resources associated with
// this session.
session->Close();

```
{c++} tensorflow::GraphDef graph; // ... Create or load graph into "graph". // This example uses the default options which connects // to a local runtime. tensorflow::SessionOptions options; std::unique_ptr<tensorflow::Session> session(tensorflow::NewSession(options)); // Create the session with this graph. tensorflow::Status s = session->Create(graph); if (!s.ok()) { ... } // Run the graph and fetch the first output of the "output" // operation, and also run to but do not return anything // for the "update_state" operation. std::vector<tensorflow::Tensor> outputs; s = session->Run({}, {"output:0"}, {"update_state"}, &outputs); if (!s.ok()) { ... } // Map the output as a flattened float tensor, and do something // with it. auto output_tensor = outputs[0].flat<float>(); if (output_tensor(0) > 0.5) { ... } // Close the session to release the resources associated with // this session. session->Close();

A Session allows concurrent calls to Run() , though a Session must be created / extended by a single thread.

Expand Down
39 changes: 4 additions & 35 deletions tensorflow/g3doc/api_docs/cc/ClassTensor.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ Creates a 1-dimensional, 0-element float tensor.

The returned Tensor is not a scalar (shape {}), but is instead an empty one-dimensional Tensor (shape {0}, NumElements() == 0). Since it has no elements, it does not need to be assigned a value and is initialized by default ( IsInitialized() is true). If this is undesirable, consider creating a one-element scalar which does require initialization:

```c++ Tensor(DT_FLOAT, TensorShape({}))

```
{c++} Tensor(DT_FLOAT, TensorShape({}))

#### `tensorflow::Tensor::Tensor(DataType type, const TensorShape &shape)` {#tensorflow_Tensor_Tensor}

Expand Down Expand Up @@ -100,12 +98,6 @@ Convenience accessor for the tensor shape.



#### `size_t tensorflow::Tensor::BufferHash() const` {#size_t_tensorflow_Tensor_BufferHash}





#### `bool tensorflow::Tensor::IsInitialized() const` {#bool_tensorflow_Tensor_IsInitialized}

If necessary, has this Tensor been initialized?
Expand Down Expand Up @@ -184,15 +176,7 @@ Use these methods when you know the data type and the number of dimensions of th

Example:

```c++ typedef float T;
Tensor my_mat(...built with Shape{rows: 3, cols: 5}...);
auto mat = my_mat.matrix<T>(); // 2D Eigen::Tensor, 3 x 5.
auto mat = my_mat.tensor<T, 2>(); // 2D Eigen::Tensor, 3 x 5.
auto vec = my_mat.vec<T>(); // CHECK fails as my_mat is 2D.
auto vec = my_mat.tensor<T, 3>(); // CHECK fails as my_mat is 2D.
auto mat = my_mat.matrix<int32>();// CHECK fails as type mismatch.

```
{c++} typedef float T; Tensor my_mat(...built with Shape{rows: 3, cols: 5}...); auto mat = my_mat.matrix<T>(); // 2D Eigen::Tensor, 3 x 5. auto mat = my_mat.tensor<T, 2>(); // 2D Eigen::Tensor, 3 x 5. auto vec = my_mat.vec<T>(); // CHECK fails as my_mat is 2D. auto vec = my_mat.tensor<T, 3>(); // CHECK fails as my_mat is 2D. auto mat = my_mat.matrix<int32>();// CHECK fails as type mismatch.

#### `TTypes<T>::Matrix tensorflow::Tensor::matrix()` {#TTypes_T_Matrix_tensorflow_Tensor_matrix}

Expand Down Expand Up @@ -220,22 +204,7 @@ These methods allow you to access the data with the dimensions and sizes of your

Example:

```c++ typedef float T;
Tensor my_ten(...built with Shape{planes: 4, rows: 3, cols: 5}...);
// 1D Eigen::Tensor, size 60:
auto flat = my_ten.flat<T>();
// 2D Eigen::Tensor 12 x 5:
auto inner = my_ten.flat_inner_dims<T>();
// 2D Eigen::Tensor 4 x 15:
auto outer = my_ten.shaped<T, 2>({4, 15});
// CHECK fails, bad num elements:
auto outer = my_ten.shaped<T, 2>({4, 8});
// 3D Eigen::Tensor 6 x 5 x 2:
auto weird = my_ten.shaped<T, 3>({6, 5, 2});
// CHECK fails, type mismatch:
auto bad = my_ten.flat<int32>();
```
{c++} typedef float T; Tensor my_ten(...built with Shape{planes: 4, rows: 3, cols: 5}...); // 1D Eigen::Tensor, size 60: auto flat = my_ten.flat<T>(); // 2D Eigen::Tensor 12 x 5: auto inner = my_ten.flat_inner_dims<T>(); // 2D Eigen::Tensor 4 x 15: auto outer = my_ten.shaped<T, 2>({4, 15}); // CHECK fails, bad num elements: auto outer = my_ten.shaped<T, 2>({4, 8}); // 3D Eigen::Tensor 6 x 5 x 2: auto weird = my_ten.shaped<T, 3>({6, 5, 2}); // CHECK fails, type mismatch: auto bad = my_ten.flat<int32>();

#### `TTypes<T>::UnalignedFlat tensorflow::Tensor::unaligned_flat()` {#TTypes_T_UnalignedFlat_tensorflow_Tensor_unaligned_flat}

Expand Down Expand Up @@ -379,7 +348,7 @@ NOTE: The underlying tensor buffer is refcounted, so the lifetime of the content

REQUIRES: `DataTypeCanUseMemcpy(dtype())`.

#### `void tensorflow::Tensor::UnsafeCopyFromInternal(const Tensor &, const TensorShape &)` {#void_tensorflow_Tensor_UnsafeCopyFromInternal}
#### `void tensorflow::Tensor::UnsafeCopyFromInternal(const Tensor &, DataType dtype, const TensorShape &)` {#void_tensorflow_Tensor_UnsafeCopyFromInternal}



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protocol buffer file in the call to `save()`.

- - -

#### `tf.train.Saver.__init__(var_list=None, reshape=False, sharded=False, max_to_keep=5, keep_checkpoint_every_n_hours=10000.0, name=None, restore_sequentially=False, saver_def=None, builder=None, defer_build=False, allow_empty=False)` {#Saver.__init__}
#### `tf.train.Saver.__init__(var_list=None, reshape=False, sharded=False, max_to_keep=5, keep_checkpoint_every_n_hours=10000.0, name=None, restore_sequentially=False, saver_def=None, builder=None, defer_build=False, allow_empty=False, write_version=1)` {#Saver.__init__}

Creates a `Saver`.

Expand Down Expand Up @@ -140,6 +140,11 @@ checkpoints per device.
* <b>`allow_empty`</b>: If `False` (default) raise an error if there are no
variables in the graph. Otherwise, construct the saver anyway and make
it a no-op.
* <b>`write_version`</b>: controls what format to use when saving checkpoints. It
also affects certain filepath matching logic. Defaults to V1
currently, and will be switched to the more memory-efficient V2 format
in the future. If set to V2, the Saver is still able to restore from
old V1 checkpoints.

##### Raises:

Expand Down
7 changes: 6 additions & 1 deletion tensorflow/g3doc/api_docs/python/state_ops.md
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ protocol buffer file in the call to `save()`.

- - -

#### `tf.train.Saver.__init__(var_list=None, reshape=False, sharded=False, max_to_keep=5, keep_checkpoint_every_n_hours=10000.0, name=None, restore_sequentially=False, saver_def=None, builder=None, defer_build=False, allow_empty=False)` {#Saver.__init__}
#### `tf.train.Saver.__init__(var_list=None, reshape=False, sharded=False, max_to_keep=5, keep_checkpoint_every_n_hours=10000.0, name=None, restore_sequentially=False, saver_def=None, builder=None, defer_build=False, allow_empty=False, write_version=1)` {#Saver.__init__}

Creates a `Saver`.

Expand Down Expand Up @@ -1590,6 +1590,11 @@ checkpoints per device.
* <b>`allow_empty`</b>: If `False` (default) raise an error if there are no
variables in the graph. Otherwise, construct the saver anyway and make
it a no-op.
* <b>`write_version`</b>: controls what format to use when saving checkpoints. It
also affects certain filepath matching logic. Defaults to V1
currently, and will be switched to the more memory-efficient V2 format
in the future. If set to V2, the Saver is still able to restore from
old V1 checkpoints.

##### Raises:

Expand Down

0 comments on commit ddf49b9

Please sign in to comment.