def _convert_to_tensor(value, dtype=None, dtype_hint=None, name=None):
if (tf.nest.is_nested(dtype) or<EOL>tf.nest.is_nested(dtype_hint)):<EOL><INDENT>if dtype is None:<EOL><INDENT>fn = lambda v, pd: tf.convert_to_tensor(v, dtype_hint=pd, name=name)<EOL>return tf.nest.map_structure(fn, value, dtype_hint)<EOL><DEDENT>elif dtype_hint is None:<EOL><INDENT>fn = lambda v, d: tf.convert_to_tensor(v, dtype=d, name=name)<EOL>return tf.nest.map_structure(fn, value, dtype_hint)<EOL><DEDENT>else:<EOL><INDENT>fn = lambda v, d, pd: tf.convert_to_tensor(  <EOL>v, dtype=d, dtype_hint=pd, name=name)<EOL>return tf.nest.map_structure(fn, value, dtype, dtype_hint)<EOL><DEDENT><DEDENT>return tf.convert_to_tensor(<EOL>value=value, dtype=dtype, dtype_hint=dtype_hint, name=name)<EOL>
Converts the given `value` to a (structure of) `Tensor`.

    This function converts Python objects of various types to a (structure of)
    `Tensor` objects. It accepts `Tensor` objects, numpy arrays, Python lists, and
    Python scalars. For example:

    Args:
      value: An object whose structure matches that of `dtype ` and/or
        `dtype_hint` and for which each leaf has a registered `Tensor` conversion
        function.
      dtype: Optional (structure of) element type for the returned tensor. If
        missing, the type is inferred from the type of `value`.
      dtype_hint: Optional (structure of) 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:
      tensor: A (structure of) `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.