Merge pull request #20539 from candyzone:master

PiperOrigin-RevId: 214121495
This commit is contained in:
TensorFlower Gardener 2018-09-22 10:57:06 -07:00
commit 425e96f3ae
3 changed files with 15 additions and 9 deletions

View File

@ -112,6 +112,8 @@ def safe_embedding_lookup_sparse(embedding_weights,
dtype = sparse_weights.dtype if sparse_weights is not None else None
if isinstance(embedding_weights, variables.PartitionedVariable):
embedding_weights = list(embedding_weights)
if not isinstance(embedding_weights[0],
resource_variable_ops.ResourceVariable):
embedding_weights = [
ops.convert_to_tensor(w, dtype=dtype) for w in embedding_weights
]

View File

@ -3433,6 +3433,8 @@ def _safe_embedding_lookup_sparse(embedding_weights,
raise ValueError('Missing embedding_weights %s.' % embedding_weights)
dtype = sparse_weights.dtype if sparse_weights is not None else None
if not isinstance(embedding_weights[0],
resource_variable_ops.ResourceVariable):
embedding_weights = [
ops.convert_to_tensor(w, dtype=dtype) for w in embedding_weights
]

View File

@ -550,6 +550,8 @@ def safe_embedding_lookup_sparse(embedding_weights,
raise ValueError('Missing embedding_weights %s.' % embedding_weights)
dtype = sparse_weights.dtype if sparse_weights is not None else None
if not isinstance(embedding_weights[0],
resource_variable_ops.ResourceVariable):
embedding_weights = [
ops.convert_to_tensor(w, dtype=dtype) for w in embedding_weights
]