Remove the need to check if y is a tensor (always convert x if not)

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang 2020-05-13 19:59:40 +00:00
parent 91914123c4
commit 39026d9e33

View File

@ -439,8 +439,8 @@ def divide(x, y, name=None):
# override names. Use a dummy class to track the runtime division behavior
return DivideDelegateWithName(x, name) / y
else:
# We do conversion here to make sure at least either x or y is a tensor.
if not (tensor_util.is_tensor(x) or tensor_util.is_tensor(y)):
# We do conversion here to make sure at least x is a tensor.
if not tensor_util.is_tensor(x):
x = ops.convert_to_tensor(x)
return x / y