Tensorflow Input Data Protocol Buffer (tf.train.example) Typeerror For Feature With String Type
I am trying to encode my data as tf.train.Example according to tensorflow's tutorial. I have a string value that I want to pass to the Features property of the Example class and I
Solution 1:
It seems that they expect s1
to be a byte string, so you need to add b
before the "
:
import tensorflow as tf
tf_example = tf.train.Example()
s1 = b"sample string 1"
tf_example.features.feature['str1'].bytes_list.value.extend([s1])
Post a Comment for "Tensorflow Input Data Protocol Buffer (tf.train.example) Typeerror For Feature With String Type"