Improve error diagnostics in embedding_lookup.

Change: 126251739
This commit is contained in:
A. Unique TensorFlower 2016-06-29 16:27:35 -08:00 committed by TensorFlower Gardener
parent 1d92cfcbf5
commit 3f488101d8

View File

@ -73,11 +73,11 @@ def embedding_lookup(params, ids, partition_strategy="mod", name=None,
Raises:
ValueError: If `params` is empty.
"""
if params is None or params == []: # pylint: disable=g-explicit-bool-comparison
raise ValueError("Need at least one param")
if not isinstance(params, list):
params = [params]
with ops.op_scope(params + [ids], name, "embedding_lookup") as name:
if not params:
raise ValueError("Need at least one param")
np = len(params) # Number of partitions
params = ops.convert_n_to_tensor_or_indexed_slices(params, name="params")
if np == 1: