Internal helper function for 'sp_t / dense_t'.
(sp_indices, sp_values, sp_shape, y, name=None)
| 965 | # "tf.(true_)div()". Until such an API decision is made, the supported usage is |
| 966 | # to explicitly use the "/" operator to invoke either truediv or div. |
| 967 | def _sparse_dense_truediv(sp_indices, sp_values, sp_shape, y, name=None): |
| 968 | """Internal helper function for 'sp_t / dense_t'.""" |
| 969 | with ops.name_scope(name, "truediv", |
| 970 | [sp_indices, sp_values, sp_shape, y]) as name: |
| 971 | sp_values = ops.convert_to_tensor(sp_values, name="sp_values") |
| 972 | y = ops.convert_to_tensor(y, name="y") |
| 973 | x_dtype = sp_values.dtype.base_dtype |
| 974 | y_dtype = y.dtype.base_dtype |
| 975 | if x_dtype != y_dtype: |
| 976 | raise TypeError("x and y must have the same dtype, got %r != %r" % |
| 977 | (x_dtype, y_dtype)) |
| 978 | try: |
| 979 | dtype = _TRUEDIV_TABLE[x_dtype] |
| 980 | except KeyError: |
| 981 | raise TypeError("Invalid dtype %r in __truediv__" % x_dtype) |
| 982 | if dtype is not None: |
| 983 | sp_values = cast(sp_values, dtype) |
| 984 | y = cast(y, dtype) |
| 985 | return gen_sparse_ops.sparse_dense_cwise_div( |
| 986 | sp_indices, sp_values, sp_shape, y, name=name) |
| 987 | |
| 988 | |
| 989 | def _truediv_python3(x, y, name=None): |
nothing calls this directly
no test coverage detected