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

Function _prune_invalid_ids

tensorflow/python/ops/embedding_ops.py:2055–2065  ·  view source on GitHub ↗

Prune invalid IDs (< 0) from the input ids and weights.

(sparse_ids, sparse_weights)

Source from the content-addressed store, hash-verified

2053 return emb_vec
2054
2055def _prune_invalid_ids(sparse_ids, sparse_weights):
2056 """Prune invalid IDs (< 0) from the input ids and weights."""
2057 is_id_valid = math_ops.greater_equal(sparse_ids.values, 0)
2058 if sparse_weights is not None:
2059 is_id_valid = math_ops.logical_and(
2060 is_id_valid,
2061 array_ops.ones_like(sparse_weights.values, dtype=dtypes.bool))
2062 sparse_ids = sparse_ops.sparse_retain(sparse_ids, is_id_valid)
2063 if sparse_weights is not None:
2064 sparse_weights = sparse_ops.sparse_retain(sparse_weights, is_id_valid)
2065 return sparse_ids, sparse_weights
2066
2067
2068def _prune_invalid_weights(sparse_ids, sparse_weights):

Calls

no outgoing calls

Tested by

no test coverage detected