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
Loading
Please sign in to comment