diff --git a/tensorflow/python/ops/embedding_ops.py b/tensorflow/python/ops/embedding_ops.py index 06be27633b5..c948eeb6fff 100644 --- a/tensorflow/python/ops/embedding_ops.py +++ b/tensorflow/python/ops/embedding_ops.py @@ -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: