Unicode in the standard TensorFlow format
<p>Following the documentation <a href="https://www.tensorflow.org/versions/r0.10/how_tos/reading_data/index.html#standard-tensorflow-format" rel="noreferrer">here</a>, I am trying to create features from unicode strings. Here is what the feature creation method looks like,</p>

<pre><code>def _bytes_feature(value):
    return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))
</code></pre>

<p>This will raise an exception, </p>

<pre><code>  File "/home/rklopfer/.virtualenvs/tf/local/lib/python2.7/site-packages/google/protobuf/internal/python_message.py", line 512, in init
    copy.extend(field_value)
  File "/home/rklopfer/.virtualenvs/tf/local/lib/python2.7/site-packages/google/protobuf/internal/containers.py", line 275, in extend
    new_values = [self._type_checker.CheckValue(elem) for elem in elem_seq_iter]
  File "/home/rklopfer/.virtualenvs/tf/local/lib/python2.7/site-packages/google/protobuf/internal/type_checkers.py", line 108, in CheckValue
    raise TypeError(message)
TypeError: u'Gross' has type &lt;type 'unicode'&gt;, but expected one of: (&lt;type 'str'&gt;,)
</code></pre>

<p>Naturally if I wrap the <code>value</code> in a <code>str</code>, it fails on the first <em>actual</em> unicode character it encounters. </p>