aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lookup
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-03-14 09:52:22 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-03-14 11:13:59 -0700
commitf861a1e545de172870147368f71e46a2ff000eaf (patch)
treed4fcba97274cf36b908fd4e7c3269732b68a2948 /tensorflow/contrib/lookup
parent3db982b63419fec84084fc606bbaa0de3277b996 (diff)
Automated rollback of change 150006782
Change: 150085723
Diffstat (limited to 'tensorflow/contrib/lookup')
-rw-r--r--tensorflow/contrib/lookup/lookup_ops.py13
-rw-r--r--tensorflow/contrib/lookup/lookup_ops_test.py11
2 files changed, 7 insertions, 17 deletions
diff --git a/tensorflow/contrib/lookup/lookup_ops.py b/tensorflow/contrib/lookup/lookup_ops.py
index 363bfa6ba2..6a20ee4440 100644
--- a/tensorflow/contrib/lookup/lookup_ops.py
+++ b/tensorflow/contrib/lookup/lookup_ops.py
@@ -1029,12 +1029,13 @@ def index_table_from_tensor(mapping,
name="table_init")
table = HashTable(
init, default_value, shared_name=shared_name, name=hash_table_scope)
- table = IdTableWithHashBuckets(
- table,
- num_oov_buckets=num_oov_buckets,
- hasher_spec=hasher_spec,
- name=feat_to_id_scope,
- key_dtype=dtype)
+ if num_oov_buckets:
+ table = IdTableWithHashBuckets(
+ table,
+ num_oov_buckets=num_oov_buckets,
+ hasher_spec=hasher_spec,
+ name=feat_to_id_scope,
+ key_dtype=dtype)
return table
diff --git a/tensorflow/contrib/lookup/lookup_ops_test.py b/tensorflow/contrib/lookup/lookup_ops_test.py
index f0a04bd3ea..fe8fa71981 100644
--- a/tensorflow/contrib/lookup/lookup_ops_test.py
+++ b/tensorflow/contrib/lookup/lookup_ops_test.py
@@ -1341,17 +1341,6 @@ class IndexTableFromTensor(test.TestCase):
data_flow_ops.tables_initializer().run()
self.assertAllEqual((1, 2, 3), ids.eval())
- def test_int32_index_table_from_tensor_with_no_buckets(self):
- with self.test_session():
- table = lookup.index_table_from_tensor(
- mapping=(42, 1, -1000), dtype=dtypes.int32)
- ids = table.lookup(
- constant_op.constant((1, -1000, 11), dtype=dtypes.int32))
-
- self.assertRaises(errors_impl.OpError, ids.eval)
- data_flow_ops.tables_initializer().run()
- self.assertAllEqual((1, 2, -1), ids.eval())
-
def test_int64_index_table_from_tensor_with_tensor_init(self):
with self.test_session():
table = lookup.index_table_from_tensor(