TF 2.0 is out! Get hands-on practice at TF World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

tft.apply_saved_model

tft.apply_saved_model(
    model_dir,
    inputs,
    tags,
    signature_name=None,
    output_keys_in_signature=None
)

Applies a SavedModel to some Tensors.

Applies a SavedModel to inputs. The SavedModel is specified with model_dir, tags and signature_name. Note that the SavedModel will be converted to an all-constants graph.

Args:

  • model_dir: A path containing a SavedModel.
  • inputs: A dict whose keys are the names from the input signature and whose values are Tensors. If there is only one input in the model's input signature then inputs can be a single Tensor.
  • tags: The tags specifying which metagraph to load from the SavedModel.
  • signature_name: Specify signature of the loaded model. The default value None can be used if there is only one signature in the MetaGraphDef.
  • output_keys_in_signature: A list of strings which should be a subset of the outputs in the signature of the SavedModel. The returned Tensors will correspond to specified output Tensors, in the same order. The default value None can be used if there is only one output from signature.

Returns:

A Tensor or list of Tensors representing the application of the SavedModel.

Raises:

  • ValueError: if inputs is invalid type, or signature_name is None but the SavedModel contains multiple signature, or inputs do not match the signature inputs, or output_keys_in_signature is not a subset of the signature outputs.