Reputation: 6776
Is it possible to decode base64 data in TensorFlow?
I looked in the documentation but didn't see any ops.
Upvotes: 0
Views: 807
Reputation: 8487
How about something like :
import base64
def base64_decode_op(x):
return tf.py_func(lambda x: base64.decodestring(x), [x], [tf.string])[0]
sess = tf.InteractiveSession()
a = base64.encodestring("abcd")
base64_decode_op(a).eval()
# prints 'abcd'
Upvotes: 1