提交 3077f277 编写于 作者: O Oleg Zabluda 提交者: François Chollet

Simplify _to_tensor() (#8272)

上级 5b7cbb73
......@@ -279,10 +279,7 @@ def _to_tensor(x, dtype):
# Returns
A tensor.
"""
x = tf.convert_to_tensor(x)
if x.dtype != dtype:
x = tf.cast(x, dtype)
return x
return tf.convert_to_tensor(x, dtype=dtype)
def is_sparse(tensor):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册