Skip to content

Latest commit

 

History

History
113 lines (71 loc) · 2.75 KB

ModuleSpec.md

File metadata and controls

113 lines (71 loc) · 2.75 KB

hub.ModuleSpec

Class ModuleSpec

Represents the contents of a Module before it has been instantiated.

A ModuleSpec is the blueprint used by Module to create one or more instances of a specific module in one or more graphs. The details on how to construct the Module are internal to the library implementation but methods to inspect a Module interface are public.

Note: Do not instantiate this class directly. Use hub.load_module_spec or hub.create_module_spec.

Methods

__init__

__init__()

Do not instantiate directly.

get_input_info_dict

get_input_info_dict(
    signature=None,
    tags=None
)

Describes the inputs required by a signature.

Args:

  • signature: A string with the signature to get inputs information for. If None, the default signature is used if defined.
  • tags: Optional set of strings, specifying the graph variant to query.

Returns:

A dict from input names to objects that provide (1) a property dtype, (2) a method get_shape() and (3) a read-only boolean property is_sparse. The first two are compatible with the common API of Tensor and SparseTensor objects.

Raises:

  • KeyError: if there is no such signature or graph variant.

get_output_info_dict

get_output_info_dict(
    signature=None,
    tags=None
)

Describes the outputs provided by a signature.

Args:

  • signature: A string with the signature to get ouputs information for. If None, the default signature is used if defined.
  • tags: Optional set of strings, specifying the graph variant to query.

Returns:

A dict from input names to objects that provide (1) a property dtype, (2) a method get_shape() and (3) a read-only boolean property is_sparse. The first two are compatible with the common API of Tensor and SparseTensor objects.

Raises:

  • KeyError: if there is no such signature or graph variant.

get_signature_names

get_signature_names(tags=None)

Returns the module's signature names as an iterable of strings.

get_tags

get_tags()

Lists the graph variants as an iterable of set of tags.