Returns callable associated with given signature or None if not callable.
tfma.model_util.get_callable(
model: Any,
signature_name: Optional[Text] = None,
required: bool = True
) -> Optional[Callable[..., Any]]
The available callables are defined by the model.signatures attribute which
are defined at the time the model is saved. For keras based models, the
model itself can also be used as can a callable attribute on the model named
after the signature_name.
Args |
model
|
A model that is callable or contains a signatures attribute. If
neither of these conditions are met, then None will be returned.
|
signature_name
|
Optional name of signature to use. If not provided then
either the default serving signature will be used (if model is not
callable) or the model itself will be used (if the model is callable). If
provided then model.signatures will be used regardless of whether the
model is callable or not.
|
required
|
True if signature_name is required to exist if provided.
|
Returns |
Callable associated with given signature (or the model itself) or None if
no callable could be found.
|
Raises |
ValueError
|
If signature_name not found in model.signatures.
|