tensorflow / community

Stores documents used by the TensorFlow developer community
Apache License 2.0
1.26k stars 576 forks source link

RFC: Making dtype promotion semantics in Tensorflow more consistent #431

Open JW1992 opened 1 year ago

JW1992 commented 1 year ago

This RFC will be open for comment until Friday, November 4th, 2022. cc @wangpengmit

Making dtype promotion semantics in Tensorflow more consistent

Status (Proposed)
Author(s) Jiawei Xia (Google), Antonio Sanchez (Google)
Sponsor Peng Wang (Google)
Updated 2022-10-18

Objective

Currently TF has no consistent, well-defined type promotion rules. This document proposes a well-defined, consistent and clear dtype promotion rule for TF. The introduced changes make TF APIs more similar to NumPy, with some differences that emphasize TF’s applications in machine learning. This should make dtype promotions in TF much more consistent and predictable. Specifically the doc discusses the preferred dtype promotion semantics/behaviors of Tensorflow (TF) and Tensorflow-numpy (TF-numpy) in the binary ops including add, sub, mul, div, pow and mod.