Divides x / y elementwise (using Python 3 division operator semantics). NOTE: Prefer using the Tensor operator or tf.divide which obey Python division operator semantics. This function forces Python 3 division operator semantics where all integer arguments are cast to floating types first.
(x, y, name=None)
| 1036 | @tf_export("math.truediv", "truediv") |
| 1037 | @dispatch.add_dispatch_support |
| 1038 | def truediv(x, y, name=None): |
| 1039 | """Divides x / y elementwise (using Python 3 division operator semantics). |
| 1040 | |
| 1041 | NOTE: Prefer using the Tensor operator or tf.divide which obey Python |
| 1042 | division operator semantics. |
| 1043 | |
| 1044 | This function forces Python 3 division operator semantics where all integer |
| 1045 | arguments are cast to floating types first. This op is generated by normal |
| 1046 | `x / y` division in Python 3 and in Python 2.7 with |
| 1047 | `from __future__ import division`. If you want integer division that rounds |
| 1048 | down, use `x // y` or `tf.math.floordiv`. |
| 1049 | |
| 1050 | `x` and `y` must have the same numeric type. If the inputs are floating |
| 1051 | point, the output will have the same type. If the inputs are integral, the |
| 1052 | inputs are cast to `float32` for `int8` and `int16` and `float64` for `int32` |
| 1053 | and `int64` (matching the behavior of Numpy). |
| 1054 | |
| 1055 | Args: |
| 1056 | x: `Tensor` numerator of numeric type. |
| 1057 | y: `Tensor` denominator of numeric type. |
| 1058 | name: A name for the operation (optional). |
| 1059 | |
| 1060 | Returns: |
| 1061 | `x / y` evaluated in floating point. |
| 1062 | |
| 1063 | Raises: |
| 1064 | TypeError: If `x` and `y` have different dtypes. |
| 1065 | """ |
| 1066 | return _truediv_python3(x, y, name) |
| 1067 | |
| 1068 | |
| 1069 | @deprecation.deprecated( |
nothing calls this directly
no test coverage detected