View source on GitHub |
Registers a function for converting objects of base_type
to Tensor
.
tf.register_tensor_conversion_function(
base_type, conversion_func, priority=100
)
The conversion function must have the following signature:
def conversion_func(value, dtype=None, name=None, as_ref=False):
# ...
It must return a Tensor
with the given dtype
if specified. If the
conversion function creates a new Tensor
, it should use the given
name
if specified. All exceptions will be propagated to the caller.
The conversion function may return NotImplemented
for some
inputs. In this case, the conversion process will continue to try
subsequent conversion functions.
If as_ref
is true, the function must return a Tensor
reference,
such as a Variable
.
Raises | |
---|---|
TypeError
|
If the arguments do not have the appropriate type. |