Skip to content

Commit

Permalink
Simplify _to_tensor() (keras-team#8272)
Browse files Browse the repository at this point in the history
  • Loading branch information
ozabluda authored and fchollet committed Oct 28, 2017
1 parent 5b7cbb7 commit 3077f27
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions keras/backend/tensorflow_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 3077f27

Please sign in to comment.