Confusion Matrix on MNIST example

Is there any way i can generate confusion matrix of the given example MNIST example.
I am able to generate loss vs epoch graph.
Kindly help me in this regard.