I am analyzing a sample code that implements a Restricted Boltzmann Machine (RBM) using Tensorflow. The input data seems to be the good old MNIST, except that apparently, it is now available in Tensorflow itself.

So, instead of running this sample code on MNIST, I want to run it on my own data. But the problem is that I do not know how


has been formatted. Is it like a CSV file? If I want to feed my own data, which comes from Wizemann's horse images, how should I format my data that is compatible with how MNIST has been formatted?

I'm very new to this stuff. So, please enlighten me if I am mistaken or my question is absurd.


1 Answer 1


Based on the official documentation after loading the data,

from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)

You can use the following line,


to see the shape of images, as you can see it is a rank-2 matrix which means images are unrolled which one dimension specifies the number of examples and another specifies the number of pixels __features.

  • $\begingroup$ Thanks. But this only says what the shape of the training data look like. If I'm not mistaken, tensorflow.examples.tutorials.mnist also contains training labels, test data and test labels. Even though I do not need labels because RBMs are unsupervised, but I still would like to know how I can make a bundle out of my data like this. I hope my question is clear. $\endgroup$ Commented Jul 21, 2018 at 15:54
  • $\begingroup$ @stressedout it is not a csv file, it is a matrix of values. If I've understood your question, you want to change the inputs but you want to know how the inputs are. $\endgroup$ Commented Jul 21, 2018 at 15:58
  • $\begingroup$ You're right. I don't want to overcomplicate it for myself at this point, so even though I still have questions about how MNIST data are stored and read, I'll leave that for another time. I'll play with my code and try to get it working. Thanks. $\endgroup$ Commented Jul 21, 2018 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.