This function can be useful when composing a new operation in Python
(such as my_func in the example above). All standard Python op
constructors apply this function to each of their Tensor-valued
inputs, which allows those ops to accept numpy arrays, Python lists,
and scalars in addition to Tensor objects.
Args
value
An object whose type has a registered Tensor conversion function.
dtype
Optional element type for the returned tensor. If missing, the type
is inferred from the type of value.
dtype_hint
Optional element type for the returned tensor, used when dtype
is None. In some cases, a caller may not have a dtype in mind when
converting to a tensor, so dtype_hint can be used as a soft preference.
If the conversion to dtype_hint is not possible, this argument has no
effect.
name
Optional name to use if a new Tensor is created.
Returns
A Tensor based on value.
Raises
TypeError
If no conversion function is registered for value to dtype.
RuntimeError
If a registered conversion function returns an invalid value.
ValueError
If the value is a tensor not of given dtype in graph mode.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2021-08-16 UTC."],[],[]]