Posts

Showing posts from April 2, 2019

Convert TensorFlow string to python string

Image
10 2 I am aware that in TensorFlow, a tf.string tensor is basically a byte string. I need to do some operation with a filename which is stored in a queue using tf.train.string_input_producer(). A small snippet is shown below : key, value = reader.read(filename_queue) filename = value.eval(session=sess) print(filename) However as a byte string it gives an output like the following : b'xffxd8xffxe0x00x10JFIFx00x01x01x00x00x01x00x01x00x00xffxdbx00Cx00x08x06x06x07x06x05x08x07x07x07ttx08' I tried to convert using filename = tf.decode_raw(filename, tf.uint8) filename = ''.join(chr(i) for i in filename) However Tensor objects are not iterable and hence this fails. Where am I going wrong ? Is it a missing feature in TensorFlow that tf.string be converted to a Python string easily ...