Skip to content

Commit

Permalink
Regenerate TF docs based on latest TF-Hub push.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 209572025
  • Loading branch information
TensorFlow Hub Authors authored and vbardiovskyg committed Aug 21, 2018
1 parent e8344e4 commit 3fe5793
Show file tree
Hide file tree
Showing 16 changed files with 181 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/api_docs/python/_toc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ toc:
path: /TARGET_DOC_ROOT/VERSION/api_docs/python/hub
- title: add_signature
path: /TARGET_DOC_ROOT/VERSION/api_docs/python/hub/add_signature
- title: attach_message
path: /TARGET_DOC_ROOT/VERSION/api_docs/python/hub/attach_message
- title: create_module_spec
path: /TARGET_DOC_ROOT/VERSION/api_docs/python/hub/create_module_spec
- title: create_module_spec_from_saved_model
path: /TARGET_DOC_ROOT/VERSION/api_docs/python/hub/create_module_spec_from_saved_model
- title: get_expected_image_size
path: /TARGET_DOC_ROOT/VERSION/api_docs/python/hub/get_expected_image_size
- title: get_num_image_channels
Expand Down
5 changes: 5 additions & 0 deletions docs/api_docs/python/hub.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="hub" />
<meta itemprop="path" content="stable" />
<meta itemprop="property" content="__version__"/>
</div>

Expand All @@ -19,8 +20,12 @@ TensorFlow Hub Library.

[`add_signature(...)`](./hub/add_signature.md): Adds a signature to the module definition.

[`attach_message(...)`](./hub/attach_message.md): Adds an attached message to the module definition.

[`create_module_spec(...)`](./hub/create_module_spec.md): Creates a ModuleSpec from a function that builds the module's graph.

[`create_module_spec_from_saved_model(...)`](./hub/create_module_spec_from_saved_model.md): Experimental: Create a ModuleSpec out of a SavedModel.

[`get_expected_image_size(...)`](./hub/get_expected_image_size.md): Returns expected [height, width] dimensions of an image input.

[`get_num_image_channels(...)`](./hub/get_num_image_channels.md): Returns expected num_channels dimensions of an image input.
Expand Down
6 changes: 4 additions & 2 deletions docs/api_docs/python/hub/LatestModuleExporter.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="hub.LatestModuleExporter" />
<meta itemprop="path" content="stable" />
<meta itemprop="property" content="name"/>
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="export"/>
Expand Down Expand Up @@ -79,7 +80,7 @@ Creates an `Exporter` to use with `tf.estimator.EvalSpec`.
export(
estimator,
export_path,
checkpoint_path,
checkpoint_path=None,
eval_result=None,
is_the_final_export=None
)
Expand All @@ -104,7 +105,8 @@ Example use:
* <b>`estimator`</b>: the `Estimator` from which to export modules.
* <b>`export_path`</b>: A string containing a directory where to write the export
timestamped directories.
* <b>`checkpoint_path`</b>: The checkpoint path to export.
* <b>`checkpoint_path`</b>: The checkpoint path to export. If `None`,
`estimator.latest_checkpoint()` is used.
* <b>`eval_result`</b>: Unused.
* <b>`is_the_final_export`</b>: Unused.

Expand Down
14 changes: 14 additions & 0 deletions docs/api_docs/python/hub/Module.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="hub.Module" />
<meta itemprop="path" content="stable" />
<meta itemprop="property" content="variable_map"/>
<meta itemprop="property" content="__call__"/>
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="export"/>
<meta itemprop="property" content="get_attached_message"/>
<meta itemprop="property" content="get_input_info_dict"/>
<meta itemprop="property" content="get_output_info_dict"/>
<meta itemprop="property" content="get_signature_names"/>
Expand Down Expand Up @@ -220,6 +222,18 @@ of variables.

* <b>`RuntimeError`</b>: if there is an issue during the export.

<h3 id="get_attached_message"><code>get_attached_message</code></h3>

``` python
get_attached_message(
key,
message_type,
required=False
)
```

Calls ModuleSpec.get_attached_message(); see there for more.

<h3 id="get_input_info_dict"><code>get_input_info_dict</code></h3>

``` python
Expand Down
48 changes: 48 additions & 0 deletions docs/api_docs/python/hub/ModuleSpec.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="hub.ModuleSpec" />
<meta itemprop="path" content="stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="get_attached_message"/>
<meta itemprop="property" content="get_input_info_dict"/>
<meta itemprop="property" content="get_output_info_dict"/>
<meta itemprop="property" content="get_signature_names"/>
Expand Down Expand Up @@ -33,6 +35,52 @@ __init__()

Do not instantiate directly.

<h3 id="get_attached_message"><code>get_attached_message</code></h3>

``` python
get_attached_message(
key,
message_type,
tags=None,
required=False
)
```

Returns the message attached to the module under the given key, or None.

Module publishers can attach protocol messages to modules at creation time
to provide module consumers with additional information, e.g., on module
usage or provenance (see see hub.attach_message()). A typical use would be
to store a small set of named values with modules of a certain type so
that a support library for consumers of such modules can be parametric
in those values.

This method can also be called on a Module instantiated from a ModuleSpec,
then `tags` are set to those used in module instatiation.

#### Args:

* <b>`key`</b>: A string with the key of an attached message.
* <b>`message_type`</b>: A concrete protocol message class (*not* object) used
to parse the attached message from its serialized representation.
The message type for a particular key must be advertised with the key.
* <b>`tags`</b>: Optional set of strings, specifying the graph variant from which
to read the attached message.
* <b>`required`</b>: An optional boolean. Setting it true changes the effect of
an unknown `key` from returning None to raising a KeyError with text
about attached messages.


#### Returns:

An instance of `message_type` with the message contents attached to the
module, or `None` if `key` is unknown and `required` is False.


#### Raises:

* <b>`KeyError`</b>: if `key` is unknown and `required` is True.

<h3 id="get_input_info_dict"><code>get_input_info_dict</code></h3>

``` python
Expand Down
1 change: 1 addition & 0 deletions docs/api_docs/python/hub/add_signature.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="hub.add_signature" />
<meta itemprop="path" content="stable" />
</div>

# hub.add_signature
Expand Down
54 changes: 54 additions & 0 deletions docs/api_docs/python/hub/attach_message.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="hub.attach_message" />
<meta itemprop="path" content="stable" />
</div>

# hub.attach_message

``` python
hub.attach_message(
key,
message
)
```

Adds an attached message to the module definition.

NOTE: This must be called within a `module_fn` that is defining a Module.

See ModuleSpec.get_attached_message() for an introduction to attached messages
and the API for module consumers.

To define a new type of attached message:

* Select a reasonably descriptive name as a unique key. For now, keys must
be valid Python identifiers that start with a letter. Punctuation besides
underscores ('_') is reserved for future use in hierarchical names.

* Define a Protocol Buffer message type to store the value for the key.
(Use generic containers like google.protobuf.Value only if running
the protocol compiler is infeasible for your build process.)

* For module consumers, consider providing a small library that encapsulates
the specific call to get_attached_message() behind a higher-level
interface and supplies the right message type for parsing.

Attached messages work best for few messages of moderate size.
Avoid a large number of messages; use repetition within messages instead.
Avoid large messages (megabytes); consider module assets instead.

For modules with multiple graph versions, each graph version stores separately
what was attached from within the call to `module_fn` that defines its graph.

#### Args:

* <b>`key`</b>: A string with the unique key to retrieve this message. Must start
with a letter and contain only letters, digits and underscores. If used
repeatedly within one invocation of `module_fn`, then only the message
from the final call will be returned by `get_attached_message()`.
* <b>`message`</b>: A protocol message object, to be stored in serialized form.


#### Raises:

* <b>`ValueError`</b>: if `key` is not a string of the form of a Python identifier.
1 change: 1 addition & 0 deletions docs/api_docs/python/hub/create_module_spec.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="hub.create_module_spec" />
<meta itemprop="path" content="stable" />
</div>

# hub.create_module_spec
Expand Down
42 changes: 42 additions & 0 deletions docs/api_docs/python/hub/create_module_spec_from_saved_model.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="hub.create_module_spec_from_saved_model" />
<meta itemprop="path" content="stable" />
</div>

# hub.create_module_spec_from_saved_model

``` python
hub.create_module_spec_from_saved_model(
saved_model_path,
drop_collections=None
)
```

Experimental: Create a ModuleSpec out of a SavedModel.

Define a ModuleSpec from a SavedModel. Note that this is not guaranteed to
work in all cases and it assumes the SavedModel has followed some conventions:

- The serialized SaverDef can be ignored and instead can be reconstructed.
- The init op and main op can be ignored and instead the module can be
initialized by using the conventions followed by
`tf.train.MonitoredSession`.

Note that the set of features supported can increase over time and have side
effects that were not previously visible. The pattern followed to avoid
surprises is forcing users to declare which features to ignore (even
if they are not supported).

Note that this function creates a ModuleSpec that when exported exports a
Module (based on a modified copy of the original SavedModel) and not a
SavedModel.

#### Args:

* <b>`saved_model_path`</b>: Directory with the SavedModel to use.
* <b>`drop_collections`</b>: Additionally list of collection to drop.


#### Returns:

A ModuleSpec.
1 change: 1 addition & 0 deletions docs/api_docs/python/hub/get_expected_image_size.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="hub.get_expected_image_size" />
<meta itemprop="path" content="stable" />
</div>

# hub.get_expected_image_size
Expand Down
1 change: 1 addition & 0 deletions docs/api_docs/python/hub/get_num_image_channels.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="hub.get_num_image_channels" />
<meta itemprop="path" content="stable" />
</div>

# hub.get_num_image_channels
Expand Down
1 change: 1 addition & 0 deletions docs/api_docs/python/hub/image_embedding_column.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="hub.image_embedding_column" />
<meta itemprop="path" content="stable" />
</div>

# hub.image_embedding_column
Expand Down
1 change: 1 addition & 0 deletions docs/api_docs/python/hub/load_module_spec.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="hub.load_module_spec" />
<meta itemprop="path" content="stable" />
</div>

# hub.load_module_spec
Expand Down
1 change: 1 addition & 0 deletions docs/api_docs/python/hub/register_module_for_export.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="hub.register_module_for_export" />
<meta itemprop="path" content="stable" />
</div>

# hub.register_module_for_export
Expand Down
1 change: 1 addition & 0 deletions docs/api_docs/python/hub/text_embedding_column.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="hub.text_embedding_column" />
<meta itemprop="path" content="stable" />
</div>

# hub.text_embedding_column
Expand Down
2 changes: 2 additions & 0 deletions docs/api_docs/python/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
* <a href="./hub/Module.md"><code>hub.Module</code></a>
* <a href="./hub/ModuleSpec.md"><code>hub.ModuleSpec</code></a>
* <a href="./hub/add_signature.md"><code>hub.add_signature</code></a>
* <a href="./hub/attach_message.md"><code>hub.attach_message</code></a>
* <a href="./hub/create_module_spec.md"><code>hub.create_module_spec</code></a>
* <a href="./hub/create_module_spec_from_saved_model.md"><code>hub.create_module_spec_from_saved_model</code></a>
* <a href="./hub/get_expected_image_size.md"><code>hub.get_expected_image_size</code></a>
* <a href="./hub/get_num_image_channels.md"><code>hub.get_num_image_channels</code></a>
* <a href="./hub/image_embedding_column.md"><code>hub.image_embedding_column</code></a>
Expand Down

0 comments on commit 3fe5793

Please sign in to comment.