diff options
Diffstat (limited to 'tensorflow/examples/learn/text_classification.py')
-rw-r--r-- | tensorflow/examples/learn/text_classification.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tensorflow/examples/learn/text_classification.py b/tensorflow/examples/learn/text_classification.py index c3d00a11b9..7e10014c39 100644 --- a/tensorflow/examples/learn/text_classification.py +++ b/tensorflow/examples/learn/text_classification.py @@ -24,6 +24,7 @@ import numpy as np import pandas from sklearn import metrics import tensorflow as tf +from tensorflow.contrib.layers.python.layers import encoders learn = tf.contrib.learn @@ -37,7 +38,7 @@ n_words = 0 def bag_of_words_model(features, target): """A bag-of-words model. Note it disregards the word order in the text.""" target = tf.one_hot(target, 15, 1, 0) - features = tf.contrib.layers.bow_encoder( + features = encoders.bow_encoder( features, vocab_size=n_words, embed_dim=EMBEDDING_SIZE) logits = tf.contrib.layers.fully_connected(features, 15, activation_fn=None) loss = tf.contrib.losses.softmax_cross_entropy(logits, target) |