Prune invalid IDs (< 0) from the input ids and weights.
(sparse_ids, sparse_weights)
| 2053 | return emb_vec |
| 2054 | |
| 2055 | def _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 | |
| 2068 | def _prune_invalid_weights(sparse_ids, sparse_weights): |
no outgoing calls
no test coverage detected