Commit 3b905b0e authored by Akshay Modi's avatar Akshay Modi Committed by TensorFlower Gardener
Browse files

Respect np scalars dtype when converting to tensors.

Before this change:
Eager mode would always try to infer a dtype and convert it to int32 (since TF
prefers that), but graph would use the numpy dtype directly.
Eager would do this even if converting lists of scalars, but graph would
downcast.

After this change:
Eager and graph behave the same.
tf.convert_to_tensor(np.int64(1)).dtype == tf.int64
tf.convert_to_tensor([np.int64(1)]).dtype == tf.int32

PiperOrigin-RevId: 223823113
parent 3360c72f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment