I think this should be self.dim not self.num_classes