View source on GitHub |
Represents the type of a TensorFlow callable.
tf.types.experimental.FunctionType(
parameters=None, *, return_annotation, __validate_parameters__=True
)
FunctionType inherits from inspect.Signature which canonically represents the
structure (and optionally type) information of input parameters and output of
a Python function. Additionally, it integrates with the tf.function type
system (tf.types.experimental.TraceType
) to provide a holistic
representation of the the I/O contract of the callable. It is used for:
- Canonicalization and type-checking of Python input arguments
- Type-based dispatch to concrete functions
- Packing/unpacking structured python values to Tensors
- Generation of structured placeholder values for tracing
Attributes | |
---|---|
parameters
|
|
return_annotation
|
Child Classes
Methods
bind
bind(
*args, **kwargs
)
Get a BoundArguments object, that maps the passed args
and kwargs
to the function's signature.
Raises TypeError
if the passed arguments can not be bound.
bind_partial
bind_partial(
*args, **kwargs
)
Get a BoundArguments object, that partially maps the passed args
and kwargs
to the function's signature.
Raises TypeError
if the passed arguments can not be bound.
from_builtin
@classmethod
from_builtin( func )
Constructs Signature for the given builtin function.
Deprecated since Python 3.5, use Signature.from_callable()
.
from_callable
@classmethod
from_callable( obj, *, follow_wrapped=True )
Constructs Signature for the given callable object.
from_function
@classmethod
from_function( func )
Constructs Signature for the given python function.
Deprecated since Python 3.5, use Signature.from_callable()
.
replace
replace(
*, parameters=_void, return_annotation=_void
)
Creates a customized copy of the Signature. Pass 'parameters' and/or 'return_annotation' arguments to override them in the new copy.
__eq__
__eq__(
other
)
Return self==value.