(x, y, name=None)
| 987 | |
| 988 | |
| 989 | def _truediv_python3(x, y, name=None): |
| 990 | with ops.name_scope(name, "truediv", [x, y]) as name: |
| 991 | x = ops.convert_to_tensor(x, name="x") |
| 992 | y = ops.convert_to_tensor(y, name="y") |
| 993 | x_dtype = x.dtype.base_dtype |
| 994 | y_dtype = y.dtype.base_dtype |
| 995 | if x_dtype != y_dtype: |
| 996 | raise TypeError("x and y must have the same dtype, got %r != %r" % |
| 997 | (x_dtype, y_dtype)) |
| 998 | try: |
| 999 | dtype = _TRUEDIV_TABLE[x_dtype] |
| 1000 | except KeyError: |
| 1001 | raise TypeError("Invalid dtype %r in __truediv__" % x_dtype) |
| 1002 | if dtype is not None: |
| 1003 | x = cast(x, dtype) |
| 1004 | y = cast(y, dtype) |
| 1005 | return gen_math_ops.real_div(x, y, name=name) |
| 1006 | |
| 1007 | |
| 1008 | def _div_python2(x, y, name=None): |
no test coverage detected