The size of self.data.labels is 2666 whereas the size of self.predictions is 10. Due to different size of two variables, you are getting the error. Look into your code to determine why the size of self.predictions is 10. Once you fix that, this error should not come.