According to the TensorFlow webpage at (https://www.tensorflow.org/versions/r1.3/programmers_guide/datasets), the tf.read_file
can be used to load an image file from a given filename, and convert it to a Tensor:
image_string = tf.read_file(filename)
image_decoded = tf.image.decode_image(image_string)
In my case however, I want to load a NumPy array rather than an image. So the filename
above points to a NumPy array on my machine.
If I were to use tf.read_file(filename)
on this filename, then according to the documentation, this function returns a string Tensor (a byte array). How can I convert this into a Tensor representing the data in the NumPy array? Is there an equivalent function to tf.image.decode_image()
for decoding a NumPy array?