Loads a module from a handle.

Currently this method only works with Tensorflow 2.x and can only load modules created by calling 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, e.g.: 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.


  • handle: (string) the Module handle to resolve.


A trackable object (see tf.saved_model.load() documentation for details).


  • NotImplementedError: If the code is running against incompatible (1.x) version of TF.