MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _sparse_dense_truediv

Function _sparse_dense_truediv

tensorflow/python/ops/math_ops.py:967–986  ·  view source on GitHub ↗

Internal helper function for 'sp_t / dense_t'.

(sp_indices, sp_values, sp_shape, y, name=None)

Source from the content-addressed store, hash-verified

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.
967def _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
989def _truediv_python3(x, y, name=None):

Callers

nothing calls this directly

Calls 2

castFunction · 0.70
name_scopeMethod · 0.45

Tested by

no test coverage detected