Skip to content

Commit

Permalink
Remove dead code that was moved to module_v2.py
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 272657376
  • Loading branch information
TensorFlow Hub Authors authored and andresusanopinto committed Oct 7, 2019
1 parent 6250605 commit bac5139
Showing 1 changed file with 0 additions and 54 deletions.
54 changes: 0 additions & 54 deletions tensorflow_hub/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,57 +562,3 @@ def func(
# Yield the function since that will keep the session alive until the
# user exits the context.
yield func


def resolve(handle):
"""Resolves a module handle into a path.
Resolves a module handle into a path by downloading and caching in
location specified by TF_HUB_CACHE_DIR if needed.
Args:
handle: (string) the Module handle to resolve.
Returns:
A string representing the Module path.
"""
return registry.resolver(handle)


def load(handle):
"""Loads a module from a handle.
Currently this method only works with Tensorflow 2.x and can only load modules
created by calling tensorflow.saved_model.save(). The method works in both
eager and graph modes.
Depending on the type of handle used, the call may involve downloading a
Tensorflow Hub module to a local cache location specified by the
TFHUB_CACHE_DIR environment variable. If a copy of the module is already
present in the TFHUB_CACHE_DIR, the download step is skipped.
Currently, three types of module handles are supported:
1) Smart URL resolvers such as tfhub.dev, e.g.:
https://tfhub.dev/google/nnlm-en-dim128/1.
2) A directory on a file system supported by Tensorflow containing module
files. This may include a local directory (e.g. /usr/local/mymodule) or a
Google Cloud Storage bucket (gs://mymodule).
3) A URL pointing to a TGZ archive of a module, e.g.
https://example.com/mymodule.tar.gz.
Args:
handle: (string) the Module handle to resolve.
Returns:
A trackable object (see tf.saved_model.load() documentation for details).
Raises:
NotImplementedError: If the code is running against incompatible (1.x)
version of TF.
"""
if hasattr(tf_v1.saved_model, "load_v2"):
module_handle = resolve(handle)
return tf_v1.saved_model.load_v2(module_handle)
else:
raise NotImplementedError("hub.load() is not implemented for TF < 1.14.x, "
"Current version: %s", tf.__version__)

0 comments on commit bac5139

Please sign in to comment.