diff options
Diffstat (limited to 'tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.register_tensor_conversion_function.md')
-rw-r--r-- | tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.register_tensor_conversion_function.md | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.register_tensor_conversion_function.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.register_tensor_conversion_function.md new file mode 100644 index 0000000000..e15dcf7b40 --- /dev/null +++ b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.register_tensor_conversion_function.md @@ -0,0 +1,42 @@ +### `tf.register_tensor_conversion_function(base_type, conversion_func, priority=100)` {#register_tensor_conversion_function} + +Registers a function for converting objects of `base_type` to `Tensor`. + +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`. + +NOTE: The conversion functions will execute in order of priority, +followed by order of registration. To ensure that a conversion function +`F` runs before another conversion function `G`, ensure that `F` is +registered with a smaller priority than `G`. + +##### Args: + + +* <b>`base_type`</b>: The base type or tuple of base types for all objects that + `conversion_func` accepts. +* <b>`conversion_func`</b>: A function that converts instances of `base_type` to + `Tensor`. +* <b>`priority`</b>: Optional integer that indicates the priority for applying this + conversion function. Conversion functions with smaller priority values + run earlier than conversion functions with larger priority values. + Defaults to 100. + +##### Raises: + + +* <b>`TypeError`</b>: If the arguments do not have the appropriate type. + |