Skip to content

Commit c10129c

Browse files
committed
[Embedding] Fix embedding_lookup_sparse construct graph issue. (#176)
1 parent c51a61f commit c10129c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tensorflow/python/ops/embedding_ops.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,11 +589,11 @@ def embedding_lookup_sparse(params,
589589
segment_ids = math_ops.cast(segment_ids, dtypes.int32)
590590

591591
ids = sp_ids.values
592-
if isinstance(params[0], kv_variable_ops.EmbeddingVariable) and params[0]._filter_freq == 0:
592+
if isinstance(params[0], kv_variable_ops.EmbeddingVariable) and params[0]._filter_freq > 0:
593+
ids, idx, counts = array_ops.unique_with_counts(ids)
594+
else:
593595
ids, idx = array_ops.unique(ids)
594596
counts = None
595-
else:
596-
ids, idx, counts = array_ops.unique_with_counts(ids)
597597

598598
uniqued_blocknums = None
599599
if blocknums is not None:

0 commit comments

Comments
 (0)