用法
save_spec(
    dynamic_batch=True
)參數
- 
dynamic_batch是否將所有返回的tf.TensorSpec的批量大小設置為None。 (請注意,使用tf.keras.Input([...], batch_size=X)定義函數或順序模型時,將始終保留批量大小)。默認為True。
返回
- 
如果定義了模型輸入,則返回一個元組 (args, kwargs)。args和kwargs中的所有元素都是tf.TensorSpec。如果未定義模型輸入,則返回None。調用模型時會自動設置模型輸入model.fit,model.evaluate或model.predict。
以元組 (args, kwargs) 的形式返回調用輸入的 tf.TensorSpec。
該值在第一次調用模型後自動定義。之後,您可以在導出模型以供服務時使用它:
model = tf.keras.Model(...)
@tf.function
def serve(*args, **kwargs):
  outputs = model(*args, **kwargs)
  # Apply postprocessing steps, or add additional outputs.
  ...
  return outputs
# 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={
  'serving_default':serve.get_concrete_function(*arg_specs, **kwarg_specs)
})相關用法
- Python tf.keras.experimental.LinearModel.save用法及代碼示例
- Python tf.keras.experimental.LinearModel.compile用法及代碼示例
- Python tf.keras.experimental.LinearModel.compute_loss用法及代碼示例
- Python tf.keras.experimental.LinearModel.reset_metrics用法及代碼示例
- Python tf.keras.experimental.LinearModel.compute_metrics用法及代碼示例
- Python tf.keras.experimental.LinearModel用法及代碼示例
- Python tf.keras.experimental.WideDeepModel.compute_loss用法及代碼示例
- Python tf.keras.experimental.SequenceFeatures用法及代碼示例
- Python tf.keras.experimental.WideDeepModel用法及代碼示例
- Python tf.keras.experimental.PeepholeLSTMCell用法及代碼示例
- Python tf.keras.experimental.WideDeepModel.reset_metrics用法及代碼示例
- Python tf.keras.experimental.WideDeepModel.save_spec用法及代碼示例
- Python tf.keras.experimental.WideDeepModel.save用法及代碼示例
- Python tf.keras.experimental.WideDeepModel.compute_metrics用法及代碼示例
- Python tf.keras.experimental.WideDeepModel.compile用法及代碼示例
- Python tf.keras.estimator.model_to_estimator用法及代碼示例
- Python tf.keras.applications.inception_resnet_v2.preprocess_input用法及代碼示例
- Python tf.keras.metrics.Mean.merge_state用法及代碼示例
- Python tf.keras.layers.InputLayer用法及代碼示例
- Python tf.keras.callbacks.ReduceLROnPlateau用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.keras.experimental.LinearModel.save_spec。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
