Thank you so much for your response firstly.
Ingenral I am explaining the thing I want to do.
Goal: After dividing the MNIST dataset into a test and train. In the Test set,Imagine I don’t have labels on testset. So, I need to predict the labels on testset but using the probabilities.
Steps I did:


I calculated the prior probabilities of each Digit. (Separately for 0,1,2,3…) It’s called pi0, pi1, … pi10 as shown in the image.


I also calculated the mean, SD of each Digit separately.


But I don’t know how to calculate the covariance matrix as showed in the equations?


Finally, I need to apply that h(x) equation which I am not sure how to do effiecently in pytorch.