Description Usage Arguments Details Examples
Wraps a Hub module (or a similar callable) for TF2 as a Keras Layer.
1 |
object |
Model or layer object |
handle |
a callable object (subject to the conventions above), or a string for which 'hub_load()' returns such a callable. A string is required to save the Keras config of this Layer. |
trainable |
Boolean controlling whether this layer is trainable. |
arguments |
optionally, a list with additional keyword arguments passed to the callable. These must be JSON-serializable to save the Keras config of this layer. |
... |
Other arguments that are passed to the TensorFlow Hub module. |
This layer wraps a callable object for use as a Keras layer. The callable object can be passed directly, or be specified by a string with a handle that gets passed to 'hub_load()'.
The callable object is expected to follow the conventions detailed below. (These are met by TF2-compatible modules loaded from TensorFlow Hub.)
The callable is invoked with a single positional argument set to one tensor or a list of tensors containing the inputs to the layer. If the callable accepts a training argument, a boolean is passed for it. It is 'TRUE' if this layer is marked trainable and called for training.
If present, the following attributes of callable are understood to have special meanings: variables: a list of all tf.Variable objects that the callable depends on. trainable_variables: those elements of variables that are reported as trainable variables of this Keras Layer when the layer is trainable. regularization_losses: a list of callables to be added as losses of this Keras Layer when the layer is trainable. Each one must accept zero arguments and return a scalar tensor.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.