save_spec
- FullyConnected.save_spec(dynamic_batch=True)
Returns the tf.TensorSpec of call args as a tuple (args, kwargs).
This value is automatically defined after calling the model for the first time. Afterwards, you can use it when exporting the model for serving:
```python model = tf.keras.Model(…)
@tf.function def serve(*args, **kwargs):
# arg_specs is [tf.TensorSpec(…), …]. kwarg_specs, in this # example, is an empty dict since functional models do not use keyword # arguments. arg_specs, kwarg_specs = model.save_spec()
- model.save(path, signatures={
})
- param dynamic_batch:
Whether to set the batch sizes of all the returned tf.TensorSpec to None. (Note that when defining functional or Sequential models with tf.keras.Input([…], batch_size=X), the batch size will always be preserved). Defaults to True.
- returns:
If the model inputs are defined, returns a tuple (args, kwargs). All elements in args and kwargs are tf.TensorSpec. If the model inputs are not defined, returns None. The model inputs are automatically set when calling the model, model.fit, model.evaluate or model.predict.